summaryrefslogtreecommitdiff
path: root/Board/EM/MeWrapper/Icc
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 /Board/EM/MeWrapper/Icc
downloadzprj-master.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Board/EM/MeWrapper/Icc')
-rw-r--r--Board/EM/MeWrapper/Icc/Icc.cif13
-rw-r--r--Board/EM/MeWrapper/Icc/Icc.sdl25
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c1187
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif12
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs116
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h260
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak171
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl67
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c1272
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h167
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c141
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif16
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h139
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak99
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl263
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd438
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd239
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccStrings.unibin0 -> 24896 bytes
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif14
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs109
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efibin0 -> 43840 bytes
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak111
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl32
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs101
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efibin0 -> 43840 bytes
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h67
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c98
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h278
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif11
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak78
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl29
31 files changed, 5553 insertions, 0 deletions
diff --git a/Board/EM/MeWrapper/Icc/Icc.cif b/Board/EM/MeWrapper/Icc/Icc.cif
new file mode 100644
index 0000000..43ca476
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Icc.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "Icc"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\"
+ RefName = "Icc"
+[files]
+"Icc.sdl"
+[parts]
+"IccProtocolLib"
+"IccPlatform"
+"IccSetup"
+"IccOverClocking"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/Icc.sdl b/Board/EM/MeWrapper/Icc/Icc.sdl
new file mode 100644
index 0000000..5fef879
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Icc.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "ICC_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable ICC support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "Icc_DIR"
+End
+
+ELINK
+ Name = "ICC_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(Icc_DIR)"
+ Parent = "ICC_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c
new file mode 100644
index 0000000..4098481
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c
@@ -0,0 +1,1187 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.c 9 5/14/14 9:56p Tristinchou $
+//
+// $Revision: 9 $
+//
+// $Date: 5/14/14 9:56p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.c $
+//
+// 9 5/14/14 9:56p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 8 4/19/13 4:08a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Check DIMM Changed, and update WDT Protocol for XTU
+//
+// 7 1/28/13 5:01a Klzhan
+// Improvement : System might not power on after changing CPU when
+// Overclocking.
+//
+// 6 1/14/13 3:15a Klzhan
+//
+// 5 12/24/12 6:34a Klzhan
+// [TAG] EIP109624
+// [Category] New Feature
+// [Description] Support Lock Icc registers.
+//
+// 4 12/19/12 2:34a Klzhan
+// Update for overclocking.
+//
+// 3 9/19/12 5:54a Klzhan
+// 1. Fix Build Error when Performance is on(IccPlatform.mak).
+// 2. Avoid time-out in ICC setup Page when return from Shell.
+// 3. Remove un-used wait for Fw Init Done.
+//
+// 2 4/24/12 12:28a Klzhan
+//
+// 1 2/08/12 1:06a Klzhan
+// Initial Check in
+//
+// 5 7/27/11 3:21a Klzhan
+// Add Elinks for PCIE and PCI config.
+// Note: Don't List GBE port on this Elink.
+//
+// 4 7/15/11 12:45a Klzhan
+//
+// 3 7/08/11 4:22a Klzhan
+// [TAG] EIP64189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC to 0.7
+//
+// 2 6/27/11 8:39a Klzhan
+// Support new ICC control library
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccPlatform.c
+//
+// Description: Platform-specific ICC code
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+Copyright (c) 2009-2010 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.
+
+Module Name:
+
+ IccPlatform.c
+
+Abstract:
+
+ Platform-specific ICC code
+
+--*/
+#define __EDKII_GLUE_MEMORY_ALLOCATION_LIB_H__
+#define __EDKII_GLUE_BASE_MEMORY_LIB_H__
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include EFI_PROTOCOL_PRODUCER(IccOverClocking)
+#include EFI_PROTOCOL_PRODUCER(MeBiosPayLoadData)
+#ifdef CougarPoint_SUPPORT
+#include EFI_PROTOCOL_PRODUCER (Wdt)
+#endif
+#if EFI_SPECIFICATION_VERSION>0x20000
+#define __HII_CONFIG_ACCESS__H__
+#else
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
+#include "MeLib.h"
+#include "PchAccess.h"
+#include "IccSetup.h"
+#include "EfiPerf.h"
+//
+// without these include guards, setup.h would include AMI EFI definitions conflicting with those from EDK
+//
+#define __UEFI_HII__H__
+#define __HII_PROTOCOL_H__
+#define _HII_H_
+#define __FORM_CALLBACK_PROTOCOL_H__
+#include "Setup.h"
+#include "IccPlatform.h"
+#include "Board\EM\Platform\PlatformSetup.h"
+#if WdtPei_SUPPORT
+#include "ppi\Wdt\Wdt.h"
+#endif
+UINT64 mNonce;
+EFI_EVENT mFeedEvent;
+ICC_CONFIG mIccConfig;
+
+ICC_OVERCLOCKING_PROTOCOL* gIccOverClockingProtocol;
+
+typedef VOID (ICC_CLOCK_UPDATE) (PLATFORM_PCIE_SLOTS* PCIE_SLOT, PLATFORM_PCI_SLOTS* PCI_SLOT);
+extern ICC_CLOCK_UPDATE OEM_CLOCK_UPDATE_FUNC EndOfOemClockUpdateFunc;
+ICC_CLOCK_UPDATE* OemClockUpdate[] = {OEM_CLOCK_UPDATE_FUNC NULL};
+DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad;
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+
+#define __EFI__H__
+#define __HOB__H__
+#include <Protocol\PerfTuneProtocol.h>
+EFI_GUID gPerfTune3xProtocolGuid = PERF_TUNE_ASL_PROTOCOL_GUID;
+EFI_GUID gPerfTuneDataHobGuid = AMI_PERF_TUNE_DATA_HOB_GUID;
+EFI_GUID gHobListGuid = EFI_HOB_LIST_GUID;
+BOOLEAN gFound = FALSE;
+BOOLEAN gBootCurrent = FALSE;
+UINT16 gCurrentFrequency;
+UINT16 gPEGDMIRatio;
+ICC_CLOCK_SETTINGS gClocksetting;
+
+//----------------------------CPU Ratio GACI DATA----------------------------
+// GACI_DATA DevNameGaciData { ControlID,NumberOfValues,Precision,Flags,DefaultDataValue,MinDataValue,MaxDataValue,MinDisplayValue,MaxDisplayValue}
+static GACI_DATA IccFreqGaciData = {BIOS_HOST_CLOCK_IMPLEMENTATION, 8001, 2, 0, 10000, 10000, 18000, 10000, 18000};
+
+static GACI_DATA IccPegDmiGaciData = {BIOS_PEG_DMI_RATIO_IMPLEMENTATION, 0xFFFF, 2, 0, 0, 0, 0, 0, 0};
+#endif
+
+#define ICC_CLOCK_COUNT 8
+UINT8 ClockID;
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+#ifndef TRACE_ALWAYS
+#define TRACE_ALWAYS -1
+#endif
+typedef struct _CLOCK_DISPLAY_VALUES {
+ UINT16 ClkFreqMax;
+ UINT16 ClkFreqMin;
+ UINT16 ClkFreqCurrent;
+ UINT16 SscPercentMax;
+ UINT16 SscPercentCurrent;
+ UINT16 ClockUsage;
+ UINT8 SscChangeAllowed;
+ UINT8 SscModeUpAvailable;
+ UINT8 SscModeCenterAvailable;
+ UINT8 SscModeDownAvailable;
+ UINT8 SscModeCurrent;
+} CLOCK_DISPLAY_VALUES;
+
+typedef struct _ICC_CLK_REQUEST {
+ UINT16 Frequency;
+ UINT16 SscPercent;
+ UINT8 SscAllowed;
+ UINT8 SscMode;
+ UINT8 EveryBoot;
+} ICC_CLK_REQUEST;
+
+#define IMMEDIATE 0
+#define TEMPORARY 1
+#define PERMANENT 2
+
+#define SSC_MODE_UP 2
+#define SSC_MODE_CENTER 1
+#define SSC_MODE_DOWN 0
+
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+VOID PerfTuneIcc(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable)
+{
+ VOID *pPerfTuneDataHobList = NULL;
+ PERF_TUNE_DATA_HOB *pBiosSettingData;
+ BIOS_SETTING_DATA BiosSettingData;
+ UINT16 RequestFrequency,PEGDMIRatio,bPEGDMIRatio;
+ ICC_CLOCK_SETTINGS RequestSetting;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ EFI_STATUS Status;
+ BOOLEAN freqConsolidationBypass = TRUE;
+ ICC_LIB_STATUS IccStatus;
+ EFI_PEI_HOB_POINTERS GuidHob;
+ WDT_PROTOCOL *InternalWdtProtocol;
+ UINTN VarSize = sizeof(BIOS_SETTING_DATA);
+ BIOS_SETTING_DATA DefaultData;
+ EFI_GUID EfiSetupGuid = SETUP_GUID;
+
+ //
+ // Get Hob list
+ //
+ Status = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, &GuidHob.Raw);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ for (Status = EFI_NOT_FOUND; EFI_ERROR (Status);) {
+ if (END_OF_HOB_LIST (GuidHob)) {
+ Status = EFI_NOT_FOUND;
+ break;
+ }
+ if (GET_HOB_TYPE (GuidHob) == EFI_HOB_TYPE_GUID_EXTENSION) {
+ if (EfiCompareGuid (&gPerfTuneDataHobGuid, &GuidHob.Guid->Name)) {
+ Status = EFI_SUCCESS;
+ pBiosSettingData = (PERF_TUNE_DATA_HOB *)(GuidHob.Raw);
+ break;
+ }
+ }
+ GuidHob.Raw = GET_NEXT_HOB (GuidHob);
+ }
+
+ if (EFI_ERROR(Status)) return;
+
+ if(pBiosSettingData->IsCpuChanged || pBiosSettingData->IsDimmChanged){
+ Status = gRT->GetVariable(
+ L"OcDefault",
+ &EfiSetupGuid,
+ NULL,
+ &VarSize,
+ &DefaultData
+ );
+
+ BiosSettingData = pBiosSettingData->PerfTuneDataHob;
+ RequestFrequency = DefaultData.HostClockFreq;
+ PEGDMIRatio = DefaultData.PEGDMIRatio;
+ }else{
+ BiosSettingData = pBiosSettingData->PerfTuneDataHob;
+ RequestFrequency = BiosSettingData.HostClockFreq;
+ PEGDMIRatio = BiosSettingData.PEGDMIRatio;
+ }
+
+ if ( (PEGDMIRatio == 100) || (PEGDMIRatio == 0) || (PEGDMIRatio == 0xFFFF)){
+ bPEGDMIRatio = 0;
+ }else if ( (PEGDMIRatio == 125) || (PEGDMIRatio == 1)){
+ bPEGDMIRatio = 1;
+ }else if ( (PEGDMIRatio == 167) || (PEGDMIRatio == 2) ){
+ bPEGDMIRatio = 2;
+ }else if ( (PEGDMIRatio == 250) || (PEGDMIRatio == 3) ){
+ bPEGDMIRatio = 3;
+ }else{
+ bPEGDMIRatio = 0;
+ }
+
+ // Return if Overclocking Bclk not found
+ if((!gFound) || ((RequestFrequency == gCurrentFrequency) &&
+ (bPEGDMIRatio == gPEGDMIRatio) && !(pBiosSettingData->IsCpuChanged || pBiosSettingData->IsDimmChanged)) ) return;
+
+ if (bPEGDMIRatio == gPEGDMIRatio){
+ gBootCurrent = FALSE;
+ RequestSetting.Frequency = RequestFrequency * 10000;
+ RequestSetting.SscMode = gClocksetting.SscMode;
+ if (bPEGDMIRatio==0){
+ RequestSetting.SscPercent = 0x32;
+ }else{
+ RequestSetting.SscPercent = 0;
+ }
+ RequestSetting.DmiPegRatio = bPEGDMIRatio;
+ gIccOverClockingProtocol->SetCurrentClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+ gIccOverClockingProtocol->GetCurrentClockSettings
+ (ClockID, &RequestSetting, &IccStatus);
+
+
+ RequestFrequency = RequestSetting.Frequency/10000;
+ PEGDMIRatio = RequestSetting.DmiPegRatio;
+ }else{
+ gBootCurrent = TRUE;
+ RequestSetting.Frequency = RequestFrequency * 10000;
+ RequestSetting.SscMode = gClocksetting.SscMode;
+ if (bPEGDMIRatio==0){
+ RequestSetting.SscPercent = 0x32;
+ }else{
+ RequestSetting.SscPercent = 0;
+ }
+ RequestSetting.DmiPegRatio = bPEGDMIRatio;
+ gIccOverClockingProtocol->SetBootClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+
+ gIccOverClockingProtocol->GetBootClockSettings
+ (ClockID, &RequestSetting, &IccStatus);
+
+
+ RequestFrequency = RequestSetting.Frequency/10000;
+ PEGDMIRatio = RequestSetting.DmiPegRatio;
+ }
+
+ if(IccStatus == ICC_LIB_STATUS_SUCCESS)
+ {
+ // OverClocking Success
+ // ReStore back to OcCurrent
+ BiosSettingData.HostClockFreq = RequestFrequency;
+ IccFreqGaciData.DefaultDataValue = RequestFrequency;
+ if ( PEGDMIRatio == 0 ){
+ BiosSettingData.PEGDMIRatio = 100;
+ IccPegDmiGaciData.DefaultDataValue = 100;
+ }else if ( PEGDMIRatio == 1 ){
+ BiosSettingData.PEGDMIRatio = 125;
+ IccPegDmiGaciData.DefaultDataValue = 125;
+ }else if ( PEGDMIRatio == 2 ){
+ BiosSettingData.PEGDMIRatio = 167;
+ IccPegDmiGaciData.DefaultDataValue = 167;
+ }else if ( PEGDMIRatio == 3 ){
+ BiosSettingData.PEGDMIRatio = 250;
+ IccPegDmiGaciData.DefaultDataValue = 250;
+ }
+
+ Status = gRT->SetVariable(
+ L"OcCurrent",
+ &SetupGuid,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(BIOS_SETTING_DATA),
+ &BiosSettingData );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (gBootCurrent == TRUE){
+ Status = gBS->LocateProtocol(&gWdtProtocolGuid, NULL, &InternalWdtProtocol);
+ if(!EFI_ERROR(Status))
+ {
+ InternalWdtProtocol->AllowKnownReset();
+ }
+ IoWrite8 (0xCF9,0x06);//Setting REG/DMI ratio have to reset.
+ EFI_DEADLOOP();
+ }
+
+ return;
+}
+
+VOID
+IccXtuHandler(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINT8 i;
+ EFI_STATUS Status;
+ PERF_TUNE_ASL_PROTOCOL *PerfTune3xProtocol;
+ UINTN Len = 0;
+ UINT8 *Buffer = NULL;
+ EFI_GUID IccOverClockingProtocolGuid = ICC_OVERCLOCKING_PROTOCOL_GUID;
+
+ Status = gBS->LocateProtocol(&IccOverClockingProtocolGuid, NULL, &gIccOverClockingProtocol);
+ if(EFI_ERROR(Status)) return;
+ Status = gBS->LocateProtocol(&gPerfTune3xProtocolGuid, NULL, &PerfTune3xProtocol);
+ if(EFI_ERROR(Status)) return;
+
+ for(i = 0; i < ICC_CLOCK_COUNT ; i++)
+ {
+ ICC_LIB_STATUS IccStatus;
+ ICC_CLOCK_RANGES ClockRange;
+
+ gIccOverClockingProtocol->GetClockRanges(i, &ClockRange, &IccStatus);
+
+ if ( (ClockRange.UsageMask & (1<<ICC_CLOCK_USAGE_BCLK) ) &&
+ (ClockRange.UsageMask & (1<<ICC_CLOCK_USAGE_DMI) ) &&
+ (ClockRange.UsageMask & (1<<ICC_CLOCK_USAGE_PEG) ) &&
+ (IccStatus == ICC_LIB_STATUS_SUCCESS)
+ ) {
+ if (ClockRange.FrequencyMax != ClockRange.FrequencyMin)
+ gIccOverClockingProtocol->GetCurrentClockSettings
+ (i, &gClocksetting, &IccStatus);
+ if(IccStatus != ICC_LIB_STATUS_SUCCESS)
+ break;
+
+
+ gCurrentFrequency = gClocksetting.Frequency/10000;
+
+ // Init GACI Data
+ IccFreqGaciData.MinDataValue = ClockRange.FrequencyMin/10000;
+ IccFreqGaciData.MinDisplayValue = ClockRange.FrequencyMin/10000;
+
+ IccFreqGaciData.MaxDataValue = ClockRange.FrequencyMax/10000;
+ IccFreqGaciData.MaxDisplayValue = ClockRange.FrequencyMax/10000;
+
+ IccFreqGaciData.DefaultDataValue = gCurrentFrequency;//ClockRange.FrequencyMin/10000;
+ IccFreqGaciData.NumberOfValues = IccFreqGaciData.MaxDataValue - IccFreqGaciData.MinDataValue + 1;
+ gFound = TRUE;
+ ClockID = i;
+
+ gPEGDMIRatio = gClocksetting.DmiPegRatio;
+
+ if ( gPEGDMIRatio == 0 ){
+ IccPegDmiGaciData.DefaultDataValue = 100;
+ }else if ( gPEGDMIRatio == 1 ){
+ IccPegDmiGaciData.DefaultDataValue = 125;
+ }else if ( gPEGDMIRatio == 2 ){
+ IccPegDmiGaciData.DefaultDataValue = 167;
+ }else if ( gPEGDMIRatio == 3 ){
+ IccPegDmiGaciData.DefaultDataValue = 250;
+ }
+ break;
+ }
+ }
+ PerfTuneIcc(ImageHandle,SystemTable);
+ // reference clock frequency
+ Len = sizeof(IccFreqGaciData);
+ Status = gBS->AllocatePool(EfiBootServicesData, Len, &Buffer);
+ gBS->SetMem(Buffer, Len, 0 );
+
+ gBS->CopyMem(Buffer, &IccFreqGaciData, sizeof(IccFreqGaciData));
+ gBS->CopyMem(Buffer + sizeof(IccFreqGaciData), &IccFreqGaciData, sizeof(IccFreqGaciData));
+ Status = PerfTune3xProtocol->SetGaciData(Buffer, Len);
+ //PEG/DMI Ratio
+ Len = sizeof(IccPegDmiGaciData);
+ Status = gBS->AllocatePool(EfiBootServicesData, Len, &Buffer);
+ gBS->SetMem(Buffer, Len, 0 );
+
+ gBS->CopyMem(Buffer, &IccPegDmiGaciData, sizeof(IccPegDmiGaciData));
+ Status = PerfTune3xProtocol->SetGaciData(Buffer, Len);
+ return;
+}
+#endif
+
+EFI_STATUS
+IccPlatformEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 OldProfile;
+#ifdef CougarPoint_SUPPORT
+ UINT8 WdtStatus = V_PCH_OC_WDT_CTL_STATUS_OK;
+ WDT_PROTOCOL *WdtProtocol;
+#endif
+
+
+ DEBUG ((EFI_D_INFO, "(ICC) Entry Point to ICC_Platform\n"));
+
+ Status = ReadMainSetupData (&mIccConfig);
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to read setup data! Status = %r\n", Status));
+ return Status;
+ }
+ Status = HeciGetIccProfile (&OldProfile);
+ Status = gBS->LocateProtocol(&gMeBiosPayloadDataProtocolGuid, NULL, &mBIOSPayLoad);
+ if(EFI_ERROR(Status))
+ {
+ DEBUG ((EFI_D_ERROR, "(ICC) Get BIOS PayLoad Data Protocol fail !! Status = %r \n", Status));
+ mBIOSPayLoad = NULL;
+ }
+#ifdef CougarPoint_SUPPORT
+ Status = gBS->LocateProtocol(&gWdtProtocolGuid, NULL, &WdtProtocol);
+ if ( EFI_ERROR(Status) ) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to locate Wdt protocol, Status = %r\n",Status));
+ return EFI_SUCCESS;
+ }
+ WdtStatus = WdtProtocol->CheckStatus();
+
+ if (mIccConfig.ClocksModified != ICC_SETTINGS_NOT_MODIFIED && WdtStatus == V_PCH_OC_WDT_CTL_STATUS_FAILURE) {
+ IccFailureNotification();
+ }
+#endif
+
+ ASSERT_EFI_ERROR (Status);
+
+ if (mIccConfig.ProfileSelection != OPTION_DISABLED) {
+ ProfileSelection(mIccConfig.SelectedIccProfile);
+ };
+
+ IccMessages();
+
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+ IccXtuHandler(ImageHandle,SystemTable);
+#endif
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ClockFailureReport (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+Routine Description:
+ Displays error message just below the "press DEL to enter setup" message
+ and forces user to enter setup. This is used when BIOS-initiated changes
+ to ICC registers caused platform instability and need to be cancelled
+Arguments:
+ Event - not used
+ Context - not used
+Returns:
+ EFI_SUCCESS if everything's OK
+--*/
+{
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ UINT32 VarAttr;
+ UINTN VarSize;
+ UINT32 BootFlow;
+ EFI_GUID guidBootFlow = BOOT_FLOW_VARIABLE_GUID;
+
+ Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "(ICC) ClockFailureReport\n"));
+
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"Boot attempt failed after platform clock settings were modified by BIOS!\r\n"
+ );
+ gST->ConOut->OutputString (gST->ConOut, L"Press any key to enter SETUP.\r\n");
+ do {
+ Status = gBS->CheckEvent (gST->ConIn->WaitForKey);
+ } while (Status == EFI_NOT_READY);
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+
+ VarAttr = 0;
+ VarSize = sizeof(BootFlow);
+ Status = gRT->GetVariable(
+ L"BootFlow",
+ &guidBootFlow,
+ &VarAttr,
+ &VarSize,
+ &BootFlow );
+ if( EFI_ERROR(Status) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS;
+ VarSize = sizeof(BootFlow);
+ }
+
+ BootFlow = BOOT_FLOW_CONDITION_FIRST_BOOT;
+ gRT->SetVariable(
+ L"BootFlow",
+ &guidBootFlow,
+ VarAttr,
+ VarSize,
+ &BootFlow );
+
+ return Status;
+}
+
+EFI_STATUS
+DetectUsedClocks (
+ OUT UINT32*UsedClocks,
+ OUT UINT32*AllClocks
+ )
+/*++
+Routine Description:
+ Detects which PCI/PCIE clocks are not needed and can be turned off.
+ For PCIE, PCIE bridge is accessed, one of its registers knows if there are cards
+ present in slots
+ For PCI, this function tries to access PCI devices that would exist if PCI
+ cards were put into slots. If such access fails, then slot must be empty and
+ its clock can be turned off
+Arguments:
+ UsedClocks: bitmask for Clock Enable: 1 = enable, 0 = disable
+ AllClocks: bitmask for Clock Enable Mask: 1 = Clock Enable bit is valid, 0 = ignore Clock Enable bit
+Returns:
+ EFI_SUCCESS in all circumstances except when required protocols can't be located
+--*/
+{
+ UINT32 i;
+ UINT8 PciQnt;
+ UINT8 PciExpressQnt;
+// UINT32 BusNumberRegister;
+ UINT8 BusNumber = 0;
+ UINT8 FunctionNumber;
+ UINT16 VendorID;
+ UINT16 SlotStatus;
+ UINT32 Rcba;
+ UINT32 RootPortFunctionNumber = 0;
+ UINT8 SkipPciDetection = 0;
+ EFI_STATUS Status;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ SETUP_DATA SetupData;
+ UINTN VariableSize;
+ PLATFORM_PCIE_SLOTS PciExpressSlots[] = {PCIE_CLOCK_CONFIG{0,0,0}};
+ PLATFORM_PCI_SLOTS PciSlots[] = {PCI_CLOCK_CONFIG{0,0,0}};
+ //
+ // all PCI/PCIE-related clocks are turned off by default and only turned on when needed
+ // such negative logic covers situation where two or more slots share one clock
+ //
+ for (i = 0; OemClockUpdate[i] != NULL; i++)
+ OemClockUpdate[i](PciExpressSlots, PciSlots);
+
+
+ *UsedClocks = 0xFFFFFFFF;
+ *AllClocks = 0x0;
+
+ PciQnt = (sizeof (PciSlots) / sizeof (PLATFORM_PCI_SLOTS)) - 1;
+ PciExpressQnt = (sizeof (PciExpressSlots) / sizeof (PLATFORM_PCIE_SLOTS)) - 1;
+
+ for (i = 0; i < PciQnt; i++) {
+ *UsedClocks &= ~(PciSlots[i].Clock);
+ *AllClocks |= PciSlots[i].Clock;
+ }
+
+ for (i = 0; i < PciExpressQnt; i++) {
+ *UsedClocks &= ~(PciExpressSlots[i].Clock);
+ *AllClocks |= PciExpressSlots[i].Clock;
+ }
+
+ // PCI Express
+ //
+ //
+ // read RootPortFunctionNumber register, it knows (pcie bridge's function number) - to - (physical slot) mapping
+ //
+ if (PciExpressQnt > 0) {
+
+ Rcba = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA
+ )
+ );
+
+ Rcba &= B_PCH_LPC_RCBA_BAR;
+ RootPortFunctionNumber = MmioRead32 ((UINTN) (Rcba + R_PCH_RCRB_RPFN));
+ }
+ //
+ // detect cards in PCIE slots
+ //
+ for (i = 0; i < PciExpressQnt; i++) {
+ FunctionNumber =
+ (
+ RootPortFunctionNumber >>
+ (S_PCH_RCRB_PRFN_RP_FIELD * PciExpressSlots[i].RootPortNumber)
+ ) & 0x00000007;
+
+
+ VendorID = MmioRead16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ FunctionNumber,
+ R_PCH_PCIE_VENDOR_ID
+ )
+ );
+
+ SlotStatus = MmioRead16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ FunctionNumber,
+ R_PCH_PCIE_SLSTS
+ )
+ );
+//********************************************************************************
+ VariableSize = sizeof (SETUP_DATA);
+ Status = gRT->GetVariable (
+ L"Setup",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ PciExpressSlots[i].HotPlugSupport = SetupData.PcieRootPortHPE[i];
+//*********************************************************************************
+ if (PciExpressSlots[i].HotPlugSupport == 1 ||
+ (VendorID != 0xFFFF && ((SlotStatus & B_PCH_PCIE_SLSTS_PDS) != 0))
+ ) {
+ *UsedClocks |= PciExpressSlots[i].Clock;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) PCI(E) Clocks Disabled: 0x%08x\n", (*AllClocks & ~(*UsedClocks)) ));
+ DEBUG ((EFI_D_INFO, "(ICC) PCI(E) Clocks Enabled: 0x%08x\n", (*AllClocks & *UsedClocks ) ));
+ DEBUG ((EFI_D_INFO, "(ICC) Clocks left alone: 0x%08x\n", ~(*AllClocks) ));
+
+ return EFI_SUCCESS;
+
+}
+
+EFI_STATUS
+EFIAPI
+IccFailureNotification (
+ VOID
+ )
+/*++
+Routine Description:
+ This function should only be called if Watchdog timer expiration was detected
+ after BIOS changes ICC settings. Error message is displayed and BIOS setup is entered.
+Arguments:
+ none
+Returns:
+ EFI_SUCCESS if everything's OK
+--*/
+{
+ EFI_EVENT Event;
+ VOID *EventPointer;
+ EFI_GUID AllDriversConnectedProtocolGuid = BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ ClockFailureReport,
+ NULL,
+ &Event
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->RegisterProtocolNotify (
+ &AllDriversConnectedProtocolGuid,
+ Event,
+ &EventPointer
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) ClockFailureReport event registration; Status = 0x%02x\n", Status));
+ return Status;
+}
+
+EFI_STATUS
+OnReadyToBoot (
+IN EFI_EVENT Event,
+IN VOID *Context
+)
+{
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ UINT8 ReadyToBoot = 1;
+ EFI_STATUS Status;
+
+ Status = gRT->SetVariable (
+ L"AfterReadyToBoot",
+ &IccSetupDataGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(UINT8),
+ &ReadyToBoot
+ );
+
+ return EFI_SUCCESS;
+}
+EFI_STATUS
+IccMessages (
+ VOID
+ )
+/*++
+Routine Description:
+ Schedules SetClockEnables and LockRegisters Icc heci messages to be executed after PCI enumeration is done
+Arguments:
+ none
+Returns:
+ EFI_SUCCESS if everything's OK
+--*/
+{
+ EFI_EVENT Event;
+ VOID *EventPointer;
+ EFI_GUID AllDriversConnectedProtocolGuid = BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+ EFI_STATUS Status;
+ EFI_EVENT ReadytoBootEvent;
+ EFI_GUID EfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ SendIccMessages,
+ NULL,
+ &Event
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->RegisterProtocolNotify (
+ &AllDriversConnectedProtocolGuid,
+ Event,
+ &EventPointer
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) IccMessages event registration; Status = 0x%02x\n", Status));
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+ gBS->CreateEvent (
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &ReadytoBootEvent
+ );
+#else
+ gBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &EfiEventReadyToBootGuid,
+ &ReadytoBootEvent
+ );
+#endif
+ return Status;
+}
+
+
+UINT8
+ReadIccSoftStraps (
+ VOID
+ )
+/*++
+Routine Description:
+ Reads soft straps from flash to check who is responsible for selecting ICC clock profile.
+Arguments:
+Returns:
+ PROFILE_SELECTED_BY_BIOS
+ PROFILE_SELECTED_BY_ME
+--*/
+{
+ UINT32 PchRootComplexBar;
+ UINT32 Softstrap10;
+
+ PchRootComplexBar = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA
+ )
+ );
+
+ PchRootComplexBar &= ~BIT0;
+
+ MmioAndThenOr32 (
+ PchRootComplexBar + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | SOFTSTRAP10)
+ );
+
+ Softstrap10 = MmioRead32 (PchRootComplexBar + R_PCH_SPI_FDOD);
+
+ if (Softstrap10 & CLOCK_PROFILE_SELECTOR) {
+ return PROFILE_SELECTED_BY_ME;
+ }
+ return PROFILE_SELECTED_BY_BIOS;
+}
+
+EFI_STATUS
+ReadMainSetupData (
+ OUT ICC_CONFIG* IccConfig
+ )
+/*++
+Routine Description:
+ reads SETUP_DATA and creates IccConfig with all Icc-related setup informations
+Arguments:
+Returns:
+ filled SETUP_DATA struct
+--*/
+{
+ EFI_STATUS Status;
+ UINT32 SetupVarAttr;
+ UINTN VariableSize;
+ UINT32 Attributes;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ EFI_GUID IccPersistentDataGuid = ICC_PERSISTENT_DATA_GUID;
+ SETUP_DATA SetupData;
+ ICC_PERSISTENT_DATA IccPersistentData;
+
+ DEBUG ((EFI_D_ERROR, "(ICC) ReadMainSetupData\n"));
+
+ SetupVarAttr = 0;
+ VariableSize = sizeof (SETUP_DATA);
+
+ Status = gRT->GetVariable(
+ L"Setup",
+ &SetupGuid,
+ &SetupVarAttr,
+ &VariableSize,
+ &SetupData );
+ if( EFI_ERROR(Status) ) {
+ DEBUG ((EFI_D_ERROR, "Failed to read SETUP_DATA! Status = %r\n", Status));
+ return Status;
+ }
+
+ VariableSize = sizeof (ICC_PERSISTENT_DATA);
+
+ Status = gRT->GetVariable (
+ L"IccPersistentData",
+ &IccPersistentDataGuid,
+ &Attributes,
+ &VariableSize,
+ &IccPersistentData
+ );
+ if (EFI_ERROR (Status)) {
+ IccPersistentData.ClocksModified = ICC_SETTINGS_NOT_MODIFIED;
+ }
+
+ IccConfig->ClocksModified = IccPersistentData.ClocksModified;
+
+ IccConfig->SelectedIccProfile = SetupData.IccSelectedProfile;
+
+ if ( ReadIccSoftStraps () != PROFILE_SELECTED_BY_BIOS ) {
+ IccConfig->ProfileSelection = OPTION_DISABLED;
+ } else {
+ IccConfig->ProfileSelection = OPTION_ENABLED;
+ }
+
+ IccConfig->LockIccRegisters = OPTION_ENABLED;
+
+ //
+ // in LockMask, 0 means lock and 1 means don't lock this particular register
+ //
+ if (SetupData.IccLockRegisters == OPTION_LOCK_STATIC) {
+ IccConfig->LockMask[2] = STATIC_REGISTERS_MASK2;
+ IccConfig->LockMask[1] = STATIC_REGISTERS_MASK1;
+ IccConfig->LockMask[0] = STATIC_REGISTERS_MASK0;
+ } else {
+ IccConfig->LockMask[2] = 0;
+ IccConfig->LockMask[1] = 0;
+ IccConfig->LockMask[0] = 0;
+ }
+
+ if (SetupData.IccSetClockEnables == OPTION_ENABLED) {
+ IccConfig->SetClkEnables = OPTION_ENABLED;
+ } else {
+ IccConfig->SetClkEnables = OPTION_DISABLED;
+ }
+
+ if (IccConfig->ProfileSelection != SetupData.IccDisplayProfile) {
+ SetupData.IccDisplayProfile = IccConfig->ProfileSelection;
+ Status = gRT->SetVariable(
+ L"Setup",
+ &SetupGuid,
+ SetupVarAttr,
+ sizeof(SETUP_DATA),
+ &SetupData );
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ProfileSelection (
+ IN UINT8 NewProfile
+ )
+/*++
+Routine Description:
+ Chooses ICC clock profile to be used by platform for future boots.
+Arguments:
+ NewProfile - requested clock profile
+Returns:
+ nothing (and the platform reboots) if profile was changed
+ EFI_SUCCESS if there was no need to change profile
+ other result if HECI communication failed
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 OldProfile;
+
+ Status = HeciGetIccProfile (&OldProfile);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to read clock profile, status = %r.\n", Status));
+ return Status;
+ }
+
+ if (NewProfile != OldProfile) {
+ Status = HeciSetIccProfile (NewProfile);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to change clock profile, status = %r.\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) Clock Profile was changed, rebooting platform.\n"));
+ Status = HeciSendCbmResetRequest(CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to trigger reset, status = %r.\n", Status));
+ return Status;
+ }
+
+ EFI_DEADLOOP();
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+WaitForFwInitComplete (
+ UINT32 mSeconds
+)
+/*++
+Routine Description:
+ waits for Fw init complete - safety measure to prevent sending Heci messages
+ while FW can't receive them.
+Arguments:
+ mSeconds - limit for wait time, in miliseconds
+Returns:
+ EFI_SUCCESS if Fw init is complete
+ EFI_TIMEOUT if init is still not complete after allocated time
+ other errors when something's wrong with Heci protocol
+--*/
+{
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ UINT32 RetryCount;
+ EFI_STATUS Status;
+
+ RetryCount = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ &Heci
+ );
+
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to locate Heci protocol! Status = %r\n", Status));
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ PERF_START (0, L"Icc waiting for FwInitComplete", NULL, 0) ;
+ while (1) {
+ Heci->GetMeStatus (&MeStatus);
+ if (ME_STATUS_IS_ME_FW_INIT_COMPLETE (MeStatus)) {
+ PERF_END (0, L"Icc waiting for FwInitComplete", NULL, 0) ;
+ DEBUG ((EFI_D_INFO, "(ICC) Waited %d ms for FwInitComplete.\n", RetryCount));
+ return EFI_SUCCESS;
+ }
+ if (RetryCount > mSeconds) {
+ PERF_END (0, L"Icc waiting for FwInitComplete", NULL, 0) ;
+ DEBUG ((EFI_D_ERROR, "(ICC) Time out! Waited %d ms for FwInitComplete.\n", RetryCount));
+ return EFI_TIMEOUT;
+ }
+ RetryCount++;
+ gBS->Stall (1000);//1ms
+ }
+}
+
+EFI_STATUS
+SendIccMessages (
+IN EFI_EVENT Event,
+IN VOID *Context
+)
+/*++
+Routine Description:
+ Sends SetClockEnables and LockRegisters Icc Heci messages
+Arguments:
+ none
+Returns:
+ nothing
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 ResponseMode = 1, AccessMode = 0;/*0 - set, 1 - get*/
+ ICC_LOCK_REGS_INFO IccLockRegs;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ SETUP_DATA SetupData;
+ UINTN VariableSize;
+
+ DEBUG ((EFI_D_INFO, "(ICC) Send Icc Heci Messages\n"));
+
+ if (mIccConfig.ProfileSelection != OPTION_DISABLED) {
+ ProfileSelection(mIccConfig.SelectedIccProfile);
+ };
+
+ VariableSize = sizeof (SETUP_DATA);
+ Status = gRT->GetVariable (
+ L"Setup",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData);
+
+ ASSERT_EFI_ERROR (Status);
+
+ if (mIccConfig.SetClkEnables == OPTION_ENABLED) {
+ DetectUsedClocks (&mIccConfig.ClkEnables,
+ &mIccConfig.ClkEnablesMask
+ );
+
+ Status = HeciSetIccClockEnables (mIccConfig.ClkEnables,
+ mIccConfig.ClkEnablesMask,
+ ResponseMode
+ );
+ }
+
+ if(mBIOSPayLoad)
+ {
+ gBS->CopyMem(&(IccLockRegs.RegBundles),
+ &(mBIOSPayLoad->MeBiosPayload.IccProfile.IccLockRegInfo.RegBundles),
+ sizeof(ICC_REG_BUNDLES));
+
+ gBS->CopyMem((IccLockRegs.RegMask),
+ (mBIOSPayLoad->MeBiosPayload.IccProfile.IccLockRegInfo.RegMask),
+ sizeof(UINT32) * IccLockRegs.RegBundles.BundlesCnt);
+
+ VariableSize = sizeof(UINT32) * 3;
+ Status = gRT->GetVariable(
+ L"IccLockDefault",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ IccLockRegs.RegMask );
+ if( Status == EFI_NOT_FOUND )
+ {
+ Status = gRT->SetVariable(
+ L"IccLockDefault",
+ &SetupGuid,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ VariableSize,
+ IccLockRegs.RegMask );
+ }
+ if(SetupData.IccLockRegisters == 3)
+ {
+ IccLockRegs.RegBundles.AU = 0;
+ IccLockRegs.RegBundles.BundlesCnt = 3;
+ }
+
+ if(SetupData.IccLockRegisters == 4)
+ {
+ IccLockRegs.RegBundles.BundlesCnt = 0;
+ IccLockRegs.RegBundles.AU = 0;
+ }
+
+ if(SetupData.IccLockRegisters == 5)
+ {
+ IccLockRegs.RegBundles.BundlesCnt = 0;
+ IccLockRegs.RegBundles.AU = 1;
+ }
+
+ Status = HeciLockIccRegisters (AccessMode, ResponseMode, &IccLockRegs);
+
+ }
+
+ return EFI_SUCCESS;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif
new file mode 100644
index 0000000..7677f59
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "IccPlatform"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\IccPlatform"
+ RefName = "IccPlatform"
+[files]
+"IccPlatform.sdl"
+"IccPlatform.dxs"
+"IccPlatform.mak"
+"IccPlatform.c"
+"IccPlatform.h"
+<endComponent> \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs
new file mode 100644
index 0000000..a2912b9
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs
@@ -0,0 +1,116 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.dxs 2 5/13/13 2:41a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 5/13/13 2:41a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.dxs $
+//
+// 2 5/13/13 2:41a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix build error when Icc_OverClocking_support is
+// disabled
+//
+// 1 2/08/12 1:06a Klzhan
+// Initial Check in
+//
+// 2 6/27/11 8:39a Klzhan
+// Support New XTU protocol.
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccPlatform.dxs
+//
+// Description: Platform-specific ICC code
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccPlatform.dxs
+
+Abstract:
+
+ Platform-specific ICC code
+
+--*/
+#include "Token.h"
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+#include EFI_PROTOCOL_DEPENDENCY (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (Wdt)
+#include EFI_PROTOCOL_DEPENDENCY (PchInfo)
+#include "Protocol\IccOverClocking\IccOverClocking.h"
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+
+#define PERF_TUNE_ASL_PROTOCOL_GUID \
+ {0x32519f22, 0x3eb, 0x47b6, 0xb3, 0xef, 0xdb, 0x93, 0x98, 0xd6, 0x4e, 0x45}
+#endif
+
+DEPENDENCY_START
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+ PERF_TUNE_ASL_PROTOCOL_GUID AND
+#endif
+#if IccOverClocking_SUPPORT
+ ICC_OVERCLOCKING_PROTOCOL_GUID AND
+#endif
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ WDT_PROTOCOL_GUID AND
+ EFI_PCH_INFO_PROTOCOL_GUID
+DEPENDENCY_END
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h
new file mode 100644
index 0000000..fb4bda4
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h
@@ -0,0 +1,260 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.h 1 2/08/12 1:06a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:06a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.h $
+//
+// 1 2/08/12 1:06a Klzhan
+// Initial Check in
+//
+// 4 7/27/11 3:21a Klzhan
+// Add Elinks for PCIE and PCI config.
+// Note: Don't List GBE port on this Elink.
+//
+// 3 7/15/11 12:45a Klzhan
+//
+// 2 6/27/11 8:38a Klzhan
+// Remove un-use define.
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccPlatform.h
+//
+// Description: Platform-specific ICC code
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+/*++
+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.
+
+Module Name:
+
+ IccPlatform.h
+
+Abstract:
+
+ Platform-specific ICC code
+
+--*/
+
+#ifdef CougarPoint_SUPPORT
+#define SOFTSTRAP10 R_PCH_SPI_STRP10
+#else
+#define SOFTSTRAP10 R_PCH_SPI_PCHSTRP10
+#endif
+
+#define ICC_INIT_TIMEOUT 5000 // ms
+
+#define RETAIN_CLOCK_ENABLES_AT_RESUME_FROM_S3 0x1
+#define CLOCK_PROFILE_SELECTOR BIT22
+
+#define PROFILE_SELECTED_BY_BIOS 0
+#define PROFILE_SELECTED_BY_ME 1
+
+//
+// 96-bit mask of registers to be locked by LockIccRegister heci message
+// 0 = lock, 1 = don't
+// see CPT c-spec for register names
+//
+#define STATIC_REGISTERS_MASK2 0x00000000
+#define STATIC_REGISTERS_MASK1 0x0F0f0013
+#define STATIC_REGISTERS_MASK0 0x00000000
+
+#define OPTION_DISABLED 0
+#define OPTION_ENABLED 1
+#define OPTION_MANUAL 2
+#define OPTION_AUTO 3
+#define OPTION_LOCK_STATIC 4
+#define OPTION_LOCK_ALL 5
+#define OPTION_USE_OEM 6
+#define OPTION_OVERRIDE 7
+//
+// OCLKEN (ICC clock enables) register bit definitions
+//
+#define CLOCK_Flex0 BIT0
+#define CLOCK_Flex1 BIT1
+#define CLOCK_Flex2 BIT2
+#define CLOCK_Flex3 BIT3
+#define CLOCK_PCI_Clock0 BIT7
+#define CLOCK_PCI_Clock1 BIT8
+#define CLOCK_PCI_Clock2 BIT9
+#define CLOCK_PCI_Clock3 BIT10
+#define CLOCK_PCI_Clock4 BIT11
+#define CLOCK_SRC0 BIT16
+#define CLOCK_SRC1 BIT17
+#define CLOCK_SRC2 BIT18
+#define CLOCK_SRC3 BIT19
+#define CLOCK_SRC4 BIT20
+#define CLOCK_SRC5 BIT21
+#define CLOCK_SRC6 BIT22
+#define CLOCK_SRC7 BIT23
+#define CLOCK_CSI_SRC8 BIT24
+#define CLOCK_CSI_DP BIT25
+#define CLOCK_PEG_A BIT26
+#define CLOCK_PEG_B BIT27
+#define CLOCK_DMI BIT28
+
+#define BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID \
+ {0xdbc9fd21, 0xfad8, 0x45b0, 0x9e, 0x78, 0x27, 0x15, 0x88, 0x67, 0xcc, 0x93}
+
+typedef struct {
+ UINT32 Clock;
+ UINT8 DeviceNumber;
+ BOOLEAN HotPlugSupport;
+} PLATFORM_PCI_SLOTS;
+
+typedef struct {
+ UINT32 Clock;
+ UINT8 RootPortNumber;
+ BOOLEAN HotPlugSupport;
+} PLATFORM_PCIE_SLOTS;
+
+typedef struct _ICC_CONFIG {
+ UINT8 LockIccRegisters;
+ UINT8 SetClkEnables;
+ UINT8 ProfileSelection;
+ UINT8 SelectedIccProfile;
+ UINT32 LockMask[3];
+ UINT32 ClkEnables;
+ UINT32 ClkEnablesMask;
+ UINT8 ClocksModified;
+} ICC_CONFIG;
+
+VOID
+DisableProfileSelection (
+ VOID
+ );
+
+EFI_STATUS
+ProfileSelection (
+ IN UINT8 NewProfile
+ );
+
+EFI_STATUS
+DetectUsedClocks (
+ OUT UINT32 *UsedClocks,
+ OUT UINT32 *AllClocks
+ );
+
+EFI_STATUS
+CallSetClockEnables (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+ReadMainSetupData (
+ ICC_CONFIG* IccConfig
+ );
+
+UINT8
+ReadIccSoftStraps (
+ VOID
+ );
+
+EFI_STATUS
+WaitForFwInitComplete (
+ UINT32 uSeconds
+ );
+
+EFI_STATUS
+IccFailureNotification (
+ VOID
+ );
+
+EFI_STATUS
+SendIccMessages (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+IccMessages (
+ VOID
+ );
+
+#ifdef CougarPoint_SUPPORT
+
+EFI_STATUS
+WdtSupport (
+ VOID
+ );
+
+EFI_STATUS
+FeedWatchdog (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+StopFeedingWatchdog (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif;
+
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+typedef struct _ACPI_HDR {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT8 Revision;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 OemTblId[8];
+ UINT32 OemRev;
+ UINT32 CreatorId;
+ UINT32 CreatorRev;
+} ACPI_HDR,*PACPI_HDR;
+#endif;
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak
new file mode 100644
index 0000000..71bca92
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak
@@ -0,0 +1,171 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.mak 5 9/27/12 6:23a Klzhan $
+#
+# $Revision: 5 $
+#
+# $Date: 9/27/12 6:23a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.mak $
+#
+# 5 9/27/12 6:23a Klzhan
+# Fix build error
+#
+# 4 9/19/12 5:54a Klzhan
+# 1. Fix Build Error when Performance is on(IccPlatform.mak).
+# 2. Avoid time-out in ICC setup Page when return from Shell.
+# 3. Remove un-used wait for Fw Init Done.
+#
+# 3 4/24/12 12:28a Klzhan
+#
+# 2 2/23/12 8:57a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:06a Klzhan
+# Initial Check in
+#
+# 4 9/06/11 6:38a Klzhan
+# Remove __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
+#
+# 3 7/27/11 3:21a Klzhan
+# Add Elinks for PCIE and PCI config.
+# Note: Don't List GBE port on this Elink.
+#
+# 2 7/15/11 12:45a Klzhan
+#
+# 1 2/25/11 1:42a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccPlatform.mak
+#
+# Description: MakFile for Platform-specific ICC code
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : IccPlatform
+
+$(BUILD_DIR)\IccPlatform.mak : $(IccPlatform_DIR)\$(@B).cif $(BUILD_RULES)
+ $(CIF2MAK) $(IccPlatform_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IccPlatform : $(BUILD_DIR)\IccPlatform.mak IccPlatform_Bin
+
+IccPlatform_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(NB_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(ICC_INCLUDES)\
+ /I$(PROJECT_DIR)\
+ /IInclude\
+
+IccPlatform_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(EFIGUIDLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGluePeiDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciCf8Lib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+IccPlatform_DEFINES=\
+ $(MY_DEFINES)\
+ $(DxeCpuBuildDefine)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=IccPlatformEntryPoint"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+ICC_ELINKS = \
+/D\"OEM_CLOCK_UPDATE_FUNC=$(OEMClockUpdateFunc)\"\
+!IF "$(OEMPCIEClockConfig)" == ""
+/D\"PCIE_CLOCK_CONFIG=$(PCIEClockConfig)\"\
+!ELSE
+/D\"PCIE_CLOCK_CONFIG=$(OEMPCIEClockConfig)\"\
+!ENDIF
+!IF "$(OEMPCIClockConfig)" == ""
+/D\"PCI_CLOCK_CONFIG=$(PCIClockConfig)\"
+!ELSE
+/D\"PCI_CLOCK_CONFIG=$(OEMPCIClockConfig)\"
+!ENDIF
+
+
+IccPlatform_Bin : $(IccPlatform_LIBS) $(OemClock_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IccPlatform.mak all\
+ "MY_INCLUDES=$(IccPlatform_INCLUDES)"\
+ "MY_DEFINES=$(IccPlatform_DEFINES)"\
+ "CFLAGS=$(CFLAGS) $(ICC_ELINKS)" \
+ GUID=14257B56-BDA2-4faf-8E4F-C885DF75583C\
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(IccPlatform_DIR)\IccPlatform.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl
new file mode 100644
index 0000000..0bb0e9a
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl
@@ -0,0 +1,67 @@
+TOKEN
+ Name = "IccPlatform_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable ICC support in Project in DXE Phase"
+End
+
+MODULE
+ Help = "Includes IccPlatform.mak to Project"
+ File = "IccPlatform.mak"
+End
+
+PATH
+ Name = "IccPlatform_DIR"
+ Help = "Icc platform dir"
+End
+
+ELINK
+ Name = "/I$(IccPlatform_DIR)"
+ Parent = "ICC_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccPlatform.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PCIEClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCIE port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "PCIClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCI port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OEMPCIEClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCIE port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OEMPCIClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCI port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OEMClockUpdateFunc"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCI port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OemClock_LIB"
+ InvokeOrder = ReplaceParent
+End
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c
new file mode 100644
index 0000000..8dcd104
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c
@@ -0,0 +1,1272 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccCallbacks.c 11 5/14/14 9:57p Tristinchou $
+//
+// $Revision: 11 $
+//
+// $Date: 5/14/14 9:57p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccCallbacks.c $
+//
+// 11 5/14/14 9:57p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 10 8/09/13 2:17a Klzhan
+// [TAG] EIP131037
+// [Category] Improvement
+// [Description] Skip Using Icc Protocol after End of Post.
+//
+// 9 5/13/13 2:42a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] FIx build error when Icc_OverClocking_Support is
+// disabled.
+//
+// 8 12/27/12 6:36a Klzhan
+// [TAG] EIP104882
+// [Category] Improvement
+// [Description] Avoid running ICC callbacks when Load Default.
+//
+// 7 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 6 9/19/12 5:58a Klzhan
+// Avoid time-out in ICC setup Page when return from Shell.
+//
+// 5 7/02/12 11:43p Klzhan
+// [TAG] EIP94113
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC0.6
+//
+// 4 5/14/12 5:29a Klzhan
+// Remove Debug code
+//
+// 3 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 2 4/24/12 12:30a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 6 9/06/11 6:11a Klzhan
+// [TAG] EIP67462
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC 08.00.00.022.1
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 5 7/26/11 5:58a Klzhan
+// Support EFI 2.3
+//
+// 4 6/27/11 3:22a Klzhan
+// Correct SscMode when Set frequency.
+//
+// 3 6/24/11 7:20a Klzhan
+// Remove un-use debug message.
+//
+// 2 6/23/11 11:31p Klzhan
+// [TAG] EIP62129
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support ICC Control Library 8.0.0.19.
+// [Files] IccCallbacks.c, IccCallbacks.h
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccCallbacks.c
+//
+// Description: Setup hooks for ICC.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccCallbacks.c
+
+Abstract:
+
+ Setup hooks for ICC.
+
+--*/
+
+#include <AmiDxeLib.h>
+#include <Setup.h>
+#include <SetupStrTokens.h>
+#include "AUTOID.h"
+#include "Protocol\AMIPostMgr.h"
+#include "Protocol\IccOverClocking\IccOverClocking.h"
+#include "IccSetup.h"
+#include "IccCallbacks.h"
+#include "PchAccess.h"
+#ifdef CougarPoint_SUPPORT
+#include "Protocol\Wdt\Wdt.h"
+#include "Protocol\WdtApp\WdtApp.h"
+#endif
+#include "Protocol\MePlatformPolicy\MePlatformPolicy.h"
+
+UINT8 mActiveSubmenu = ICC_CLOCK_COUNT;
+ICC_OVERCLOCKING_PROTOCOL* gIccOverClockingProtocol;
+ICC_CLOCK_RANGES mRanges[ICC_CLOCK_COUNT];
+CLOCK_DISPLAY_VALUES values; // Store clock Infomations of current page.
+UINT16 mBootTimeClkDiv[ICC_CLOCK_COUNT];
+UINT8 mWatchdogEnabled;
+
+CHAR16* mClockUsageName[] = {
+ L"BCLK",
+ L"DMI",
+ L"PEG",
+ L"PCIe",
+ L"PCI33",
+ L"RESERVED",
+ L"SATA",
+ L"USB3",
+ L"IGD",
+ L"IGD Bending",
+ L"RESERVED",
+ L"GFX",
+ L"USB Legacy",
+ L"PCH Legacy"
+};
+
+CHAR16* mClockName[] = {
+ L"Clock1",
+ L"Clock2",
+ L"Clock3",
+ L"Clock4",
+ L"Clock5",
+ L"Clock6",
+ L"Clock7",
+ L"Clock8"
+};
+
+CHAR16* mClockUsageNone = L"Not used";
+
+UINT16* mModeName[] = {
+ L"Down",
+ L"Center",
+ L"Up",
+ L"None"
+};
+
+EFI_HII_HANDLE gHiiHandle;
+//
+// Blocks entry to ICC clock submenus after End Of Post event
+//
+UINT8 mAfterEndOfPost = 0;
+
+#define NAME_ARRAY_SIZE (( sizeof(mClockUsageName)/sizeof(mClockUsageName[0]) ))
+
+#if (SUPPORTED_CLOCKS != ICC_CLOCK_COUNT)
+#error Ambiguous number of supported clocks
+#endif
+
+#ifndef StrCat
+#define StrCat(a,b) Wcscpy (a + Wcslen (a), b)
+#endif
+
+#define AMI_CALLBACK_CONTROL_UPDATE 1
+#define AMI_CALLBACK_RETRIEVE 2
+#define AMI_CALLBACK_FORM_OPEN 3
+#define AMI_CALLBACK_FORM_CLOSE 4
+#define AMI_CALLBACK_FORM_DEFAULT_STANDARD 0x1000
+#define AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING 0x1001
+
+EFI_STATUS
+OnReadyToBoot (
+IN EFI_EVENT Event,
+IN VOID *Context
+)
+/*++
+Routine Description:
+
+ This function is executed on ReadyToBoot event.
+ If permanent or temporary ICC modifications were made, platform needs to be restarted.
+ Unlike ordinary setup options, ICC modifications can't be programmed to cause automatic reset.
+ Instead this function, executed on ReadyToBoot event, causes reset.
+
+Arguments:
+ Event pointer to event that caused this function to be executed
+ Context not used here
+
+Returns:
+ always SUCCESS
+--*/
+{
+ mAfterEndOfPost = 1;
+ pBS->CloseEvent(Event);
+ if (GetIccPersistentData() == ICC_SETTINGS_RECENTLY_MODIFIED) {
+ pRS->ResetSystem(EfiResetCold, 0, 0, 0);
+ } else if (GetIccPersistentData() == ICC_SETTINGS_PREVIOUSLY_MODIFIED) {
+ SetIccPersistentData(ICC_SETTINGS_NOT_MODIFIED);
+ }
+ return EFI_SUCCESS;
+}
+
+VOID
+InitICCStrings (
+ EFI_HII_HANDLE HiiHandle,
+ UINT16 Class
+ )
+/*++
+Routine Description:
+
+ This function is executed when Setup module loads.
+ Registers OnReadyToBoot function to be executed on ReadyToBoot event.
+ Remembers HiiHandle, pointer to setup browser's runtime variable store
+
+Arguments:
+ HiiHandle
+ Class
+
+Returns:
+ always SUCCESS
+--*/
+{
+ static UINT8 mInitStringComplete = 0;
+ EFI_EVENT Event;
+ EFI_GUID EfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+
+ if (mInitStringComplete == 1) {
+ return;
+ } else {
+ if(Class == ADVANCED_FORM_SET_CLASS) {
+ mInitStringComplete = 1;
+ gHiiHandle = HiiHandle;
+
+ if (GetIccPersistentData() == ICC_SETTINGS_RECENTLY_MODIFIED) {
+ SetIccPersistentData(ICC_SETTINGS_PREVIOUSLY_MODIFIED);
+ }
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+ pBS->CreateEvent (
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &Event
+ );
+#else
+ pBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &EfiEventReadyToBootGuid,
+ &Event
+ );
+#endif
+
+ }
+ }
+}
+
+EFI_STATUS
+InitIccMenu (
+ IN ICC_VOLATILE_SETUP_DATA* IccSetupData
+ )
+/*++
+Routine Description:
+ Initializes text strings and setup variables connected with ICC menu.
+ If there is an error during initialization, displays messagebox with error details
+Arguments:
+ Pointer to Icc setup data structure
+Returns:
+ EFI_SUCCESS if everything went OK
+ otherwise, an ERROR
+--*/
+{
+ UINTN VariableSize;
+ UINT8 i;
+ EFI_STATUS Status;
+#if IccOverClocking_SUPPORT
+ ICC_LIB_STATUS IccStatus;
+#endif
+ ICC_LIB_VERSION Version;
+ SETUP_DATA SetupData;
+ EFI_GUID IccOverClockingProtocolGuid = ICC_OVERCLOCKING_PROTOCOL_GUID;
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ VariableSize = sizeof (SETUP_DATA);
+
+ Status = pRS->GetVariable (
+ L"Setup",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ VariableSize = sizeof(UINT8);
+ Status = pRS->GetVariable (
+ L"AfterReadyToBoot",
+ &IccSetupDataGuid,
+ NULL,
+ &VariableSize,
+ &mAfterEndOfPost);
+#if IccOverClocking_SUPPORT
+ Status = pBS->LocateProtocol(&IccOverClockingProtocolGuid, NULL, &gIccOverClockingProtocol);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ VariableSize = sizeof (UINTN);
+ mWatchdogEnabled = SetupData.IccWdtEnabled;
+
+ IccStatus = IccInitOverclocking(&Version);
+
+ if ( IccStatus != ICC_LIB_STATUS_SUCCESS ) {
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_INIT_ERROR_STRANGE), IccStatus);
+ IccSetupData->AllowAdvancedOptions = 0;
+ return EFI_DEVICE_ERROR;
+ }
+#else
+ return EFI_SUCCESS;
+#endif
+ // If init success, Set allowadvancedOption true
+// IccSetupData->AllowAdvancedOptions = 1;
+
+ InitString(
+ gHiiHandle,
+ STRING_TOKEN(STR_ICC_LIB_VERSION_NR),
+ L"%d.%d.%d.%d",
+ Version.Major,
+ Version.Minor,
+ Version.Hotfix,
+ Version.Build
+ );
+ if(mAfterEndOfPost != 1)
+ {
+ IccSetupData->AllowAdvancedOptions = 1;
+ for (i=0; i<ICC_CLOCK_COUNT; i++) {
+ IccGetFrequencies(i, &values);
+ IccSetupData->Frequency[i] = values.ClkFreqCurrent;
+ IccSetupData->SscPercent[i] = values.SscPercentCurrent;
+ IccSetupData->SscMode[i] = values.SscModeCurrent;
+ // Workaround for architecture bugs: read - don't modify - write sequence doesn't work for some clocks
+ // These clocks must not be allowed to be modified - they'll cause ICC Lib to return misleading errors
+ if (/* (values.ClockUsage & (1<<ICC_CLOCK_USAGE_GFX)) ||
+ (values.ClockUsage & (1<<ICC_CLOCK_USAGE_GFX_BENDING)) ||*/
+ (values.ClockUsage == 0)
+ ) {
+ IccSetupData->ShowSsc[i] = 0;
+ IccSetupData->ShowClock[i] = 0;
+ } else {
+ IccSetupData->ShowSsc[i] = values.SscChangeAllowed;
+ if (values.ClkFreqMax == values.ClkFreqMin) {
+ IccSetupData->ShowClock[i] = 0;
+ } else {
+ IccSetupData->ShowClock[i] = 1;
+ }
+ }
+ }
+ }else
+ IccSetupData->AllowAdvancedOptions = 0;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+IccMenuEntry (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+/*++
+Routine Description:
+ Setup callback executed when user enters Advanced->ICC menu
+ Think of it as an entry point to efi overclocking module
+ Initializes ICC OverClocking and if there are errors, disables entry into submenus
+ Without access to submenus, it is guaranteed no other callback will be executed.
+Arguments:
+Returns:
+ always SUCCESS, but in case of errors entry into submenus is disabled
+--*/
+{
+ static UINT8 FirstEntry = 1;
+ static UINT8 EopReported = 0;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ EFI_STATUS Status;
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+ EFI_GUID DxePlatformMePolicyGuid = DXE_PLATFORM_ME_POLICY_GUID;
+ DXE_ME_POLICY_PROTOCOL *DxePlatformMePolicy;
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ if(mAfterEndOfPost == 0) {
+ Status = pBS->LocateProtocol(&DxePlatformMePolicyGuid, NULL, &DxePlatformMePolicy);
+ if(!EFI_ERROR (Status)) {
+ if(DxePlatformMePolicy->MeConfig.EndOfPostDone) {
+ mAfterEndOfPost = 1;
+ }
+ }
+ }
+ //
+ // No changes to ICC menu display
+ //
+ if (EopReported == 1 || (FirstEntry ==0 && mAfterEndOfPost == 0)) {
+ return EFI_SUCCESS;
+ }
+
+ FirstEntry = 0;
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if(EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = HiiLibGetBrowserData(&SelectionBufferSize,
+ IccSetupData,
+ &IccSetupDataGuid,
+ ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+#else
+ IccSetupData = (ICC_VOLATILE_SETUP_DATA*)CallbackParameter->Data->NvRamMap;
+#endif
+
+ if (mAfterEndOfPost == 1 && EopReported == 0) {
+ IccSetupData->AllowAdvancedOptions = 0;
+ EopReported = 1;
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_AFTER_EOP));
+ } else {
+ Status = InitIccMenu(IccSetupData);
+ if (EFI_ERROR(Status)) {
+// IccSetupData->AllowAdvancedOptions = 0;
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_INIT_ERROR_STRANGE));
+ } else {
+// IccSetupData->AllowAdvancedOptions = 1;
+ }
+ }
+
+ Status = pRS->SetVariable(
+ ICC_VOLATILE_SETUP_DATA_C_NAME,
+ &IccSetupDataGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_NON_VOLATILE,
+ sizeof(ICC_VOLATILE_SETUP_DATA),
+ IccSetupData );
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+ pBS->FreePool(IccSetupData);
+
+#endif;
+
+ return EFI_SUCCESS;
+}
+
+
+
+EFI_STATUS
+EFIAPI
+IccSubmenuEntry (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+
+/*++
+Routine Description:
+ Setup callback executed when user enters any submenu of Advanced->ICC
+ Personalizes common strings for that particular clock submenu
+ Stores information on which submenu we're in, that's needed for other callbacks
+Arguments:
+Returns:
+ always SUCCESS
+--*/
+{
+ UINT8 SubMenuNumber = ICC_CLOCK_COUNT;
+ CHAR16 StringBuffer[100];
+ UINT8 i;
+ UINT8 NeedComma;
+ UINT8 LineOverflow;
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ switch (Key) {
+ case KEY_FORM1:
+ SubMenuNumber = 0;
+ break;
+ case KEY_FORM2:
+ SubMenuNumber = 1;
+ break;
+ case KEY_FORM3:
+ SubMenuNumber = 2;
+ break;
+ case KEY_FORM4:
+ SubMenuNumber = 3;
+ break;
+ case KEY_FORM5:
+ SubMenuNumber = 4;
+ break;
+ case KEY_FORM6:
+ SubMenuNumber = 5;
+ break;
+ case KEY_FORM7:
+ SubMenuNumber = 6;
+ break;
+ case KEY_FORM8:
+ SubMenuNumber = 7;
+ break;
+ default:
+ ASSERT(FALSE);
+ }
+
+ if (SubMenuNumber == mActiveSubmenu) {
+ //
+ //strings already personalized for this menu, no need to change them
+ //
+ return EFI_SUCCESS;
+ }
+
+ mActiveSubmenu = SubMenuNumber;
+
+ IccGetFrequencies(mActiveSubmenu, &values);
+ StringBuffer[0] = 0;
+ NeedComma = 0;
+ LineOverflow = 0;
+
+ //
+ // Concatenate all clock usages into two strings. If first string gets too long, second will be written
+ //
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_2), L"%s", StringBuffer);
+ if (values.ClockUsage != 0) {
+ for (i=0; i<NAME_ARRAY_SIZE; i++) {
+ if (values.ClockUsage & (1<<i)) {
+ if (NeedComma == 1) {
+ StrCat(StringBuffer, L", ");
+ }
+ if ( Wcslen(StringBuffer) + Wcslen(mClockUsageName[i]) > 25 ) {
+ LineOverflow = 1;
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_1), L"%s", StringBuffer);
+ StringBuffer[0] = 0;
+ NeedComma = 0;
+ }
+ StrCat(StringBuffer, mClockUsageName[i]);
+ NeedComma = 1;
+ }
+ }
+ } else {
+ StrCat(StringBuffer, mClockUsageNone);
+ }
+ if (LineOverflow) {
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_2), L"%s", StringBuffer);
+ } else {
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_1), L"%s", StringBuffer);
+ }
+
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_NUMBER), L"%s", mClockName[SubMenuNumber]);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_MAX_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqMax/100, values.ClkFreqMax%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_MIN_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqMin/100, values.ClkFreqMin%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqCurrent/100, values.ClkFreqCurrent%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_MODES_VALUE), L"%s%s%s",
+ (values.SscModeDownAvailable) ? L"Down " : L" ",
+ (values.SscModeCenterAvailable)? L"Center " : L" ",
+ (values.SscModeUpAvailable) ? L"Up " : L" "
+ );
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE_VALUE), L"%s", mModeName[values.SscModeCurrent]);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_MAX_VALUE), L"%d.%02d%%", values.SscPercentMax/100, values.SscPercentMax%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_VALUE), L"%d.%02d%%", values.SscPercentCurrent/100, values.SscPercentCurrent%100);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+IccAccept (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+/*++
+Routine Description:
+ Setup callback executed when user chooses 'Accept'
+ Sends requested clock parameters to ICC OverClocking
+Arguments:
+ interface to ITEM_CALLBACK_EX
+Returns:
+ always SUCCESS
+--*/
+{
+ EFI_STATUS Status;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ CLOCK_DISPLAY_VALUES values;
+ UINT8 TypeOfChange;
+ UINTN VarSize = 0;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+#endif
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ switch (Key) {
+ case KEY_CHANGE_NOW1:
+ case KEY_CHANGE_NOW2:
+ case KEY_CHANGE_NOW3:
+ case KEY_CHANGE_NOW4:
+ case KEY_CHANGE_NOW5:
+ case KEY_CHANGE_NOW6:
+ TypeOfChange = IMMEDIATE;
+ break;
+ case KEY_CHANGE_ONCE1:
+ case KEY_CHANGE_ONCE2:
+ case KEY_CHANGE_ONCE3:
+ case KEY_CHANGE_ONCE4:
+ case KEY_CHANGE_ONCE5:
+ case KEY_CHANGE_ONCE6:
+ TypeOfChange = TEMPORARY;
+ break;
+ case KEY_CHANGE_PERM1:
+ case KEY_CHANGE_PERM2:
+ case KEY_CHANGE_PERM3:
+ case KEY_CHANGE_PERM4:
+ case KEY_CHANGE_PERM5:
+ case KEY_CHANGE_PERM6:
+ TypeOfChange = PERMANENT;
+ break;
+ default:
+ ASSERT(FALSE);
+ TypeOfChange = 0; //prevent compilator warning
+ }
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if(EFI_ERROR(Status))
+ return Status;
+
+ Status = HiiLibGetBrowserData(
+ &SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+#else
+ IccSetupData = (ICC_VOLATILE_SETUP_DATA*)CallbackParameter->Data->NvRamMap;
+#endif
+ Status = SendClockChangeRequest(IccSetupData, mActiveSubmenu, TypeOfChange);
+ IccGetFrequencies(mActiveSubmenu, &values);
+
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqCurrent/100, values.ClkFreqCurrent%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE_VALUE), L"%s", mModeName[values.SscModeCurrent]);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_VALUE), L"%d.%02d%%", values.SscPercentCurrent/100, values.SscPercentCurrent%100);
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ pBS->FreePool(IccSetupData);
+#endif;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+IccFreqChange (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+/*++
+Routine Description:
+ Setup callback executed when user changes frequency
+ Calls IccFrequencyRounding() which fixes frequency and SSC parameters to allowed values
+ Having these parameters fixed decreases number of errors caused by sending wrong parameters
+Arguments:
+Returns:
+ always SUCCESS
+--*/
+{
+ EFI_STATUS Status;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ ICC_CLOCK_FREQUENCY ExpectFrequency, UserFrequency;
+ BOOLEAN HigherFrequency = FALSE;
+ ICC_LIB_STATUS IccStatus;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+#endif
+
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE))
+ return EFI_SUCCESS;
+#endif
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if(EFI_ERROR(Status))
+ return Status;
+
+ Status = HiiLibGetBrowserData(
+ &SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+#else
+ IccSetupData = (ICC_VOLATILE_SETUP_DATA*)CallbackParameter->Data->NvRamMap;
+#endif
+
+ UserFrequency = IccSetupData->Frequency[mActiveSubmenu];
+
+ if(UserFrequency >= values.ClkFreqMax)
+ {
+ IccSetupData->Frequency[mActiveSubmenu] = values.ClkFreqMax;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ pBS->FreePool(IccSetupData);
+#endif;
+ return EFI_SUCCESS;
+ }
+
+ if(UserFrequency <= values.ClkFreqMin)
+ {
+ IccSetupData->Frequency[mActiveSubmenu] = values.ClkFreqMin;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ pBS->FreePool(IccSetupData);
+#endif;
+ return EFI_SUCCESS;
+ }
+
+ if(UserFrequency > values.ClkFreqCurrent)
+ HigherFrequency = TRUE;
+
+ {
+ UserFrequency = (UserFrequency) * 10000;
+ gIccOverClockingProtocol->GetNextFrequency(mActiveSubmenu,
+ UserFrequency,
+ &UserFrequency,
+ &IccStatus);
+
+ gIccOverClockingProtocol->GetPreviousFrequency(mActiveSubmenu,
+ UserFrequency,
+ &ExpectFrequency,
+ &IccStatus);
+ }
+
+ if (IccStatus == ICC_LIB_STATUS_SUCCESS) {
+ IccSetupData->Frequency[mActiveSubmenu] = ExpectFrequency/10000;
+ }
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ pBS->FreePool(IccSetupData);
+#endif;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SendClockChangeRequest (
+ IN ICC_VOLATILE_SETUP_DATA* IccSetupData,
+ IN UINT8 ClockID,
+ IN UINT8 TypeOfChange
+ )
+/*++
+Routine Description:
+ Executed by setup calback function
+ Based on data entered by user, sends clock change requests to ICC OverClocking
+ Writing to susram or flash requires that old susram and flash contents be invalidated
+ In case of any problem, messagebox is displayed so user can know what corrective action is required
+Arguments:
+ initial clock divider value
+Returns:
+ validated clock divider value
+--*/
+{
+
+ UINT8 answer = 1;
+ ICC_LIB_STATUS IccStatus;
+ ICC_CLOCK_SETTINGS RequestSetting;
+ BOOLEAN freqConsolidationBypass = TRUE, permanentChange;
+
+ if(TypeOfChange == PERMANENT)
+ permanentChange = TRUE;
+
+ if(TypeOfChange == TEMPORARY)
+ permanentChange = FALSE;
+
+ // Prepare Setting
+ gIccOverClockingProtocol->GetCurrentClockSettings(ClockID, &RequestSetting, &IccStatus);
+ RequestSetting.Frequency = IccSetupData->Frequency[ClockID] * 10000;
+ RequestSetting.SscMode = SscNumberToSscMode(IccSetupData->SscMode[ClockID]);
+ RequestSetting.SscPercent = (UINT8)IccSetupData->SscPercent[ClockID];
+ // Only ICC_DMI_PEG_RATIO_5_TO_5 is support in PPT.
+ RequestSetting.DmiPegRatio = (UINT8)IccSetupData->DmiPegRatio[ClockID];
+
+ if(TypeOfChange == IMMEDIATE)
+ {
+ gIccOverClockingProtocol->SetCurrentClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+ }else
+ {
+ gIccOverClockingProtocol->SetBootClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+ }
+
+ if (IccStatus != ICC_LIB_STATUS_SUCCESS) {
+ if (TypeOfChange == TEMPORARY) {
+ MessageBox (MSGBOX_TYPE_OKCANCEL, &answer, STRING_TOKEN(STR_ICC_MSGBOX_ONCE_OVERWRITE));
+ } else if (TypeOfChange == PERMANENT) {
+ MessageBox (MSGBOX_TYPE_OKCANCEL, &answer, STRING_TOKEN(STR_ICC_MSGBOX_PERM_OVERWRITE));
+ }
+ if (answer != MSGBOX_YES) {
+ return ICC_LIB_STATUS_SUCCESS;
+ }
+ }
+
+ switch (IccStatus) {
+ case ICC_LIB_STATUS_DYNAMIC_CHANGE_NOT_ALLOWED:
+ MessageBox (MSGBOX_TYPE_OKCANCEL, &answer, STRING_TOKEN(STR_ICC_MSGBOX_NO_DYNAMIC), mClockName[ClockID]);
+ break;
+ case ICC_LIB_STATUS_REGISTER_IS_LOCKED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_LOCKED));
+ break;
+ case ICC_LIB_STATUS_FREQ_TOO_HIGH:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_FREQ_HIGH), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_FREQ_TOO_LOW:
+ MessageBox (MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_FREQ_LOW), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_TOO_HIGH:
+ case ICC_LIB_STATUS_SSC_OUT_OF_RANGE:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_HIGH), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_TOO_LOW:
+ MessageBox (MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_LOW), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_MODE_NOT_SUPPORTED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_MODE), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_FREQ_MUST_HAVE_ZERO_SSC:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_DISABLED), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_CHANGE_NOT_ALLOWED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_CONSTANT), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_MEI_INITIALIZATION_FAILED:
+ case ICC_LIB_STATUS_MEI_CONNECTION_FAILED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_HECI));
+ break;
+ case ICC_LIB_STATUS_SUCCESS:
+ if (TypeOfChange == IMMEDIATE) {
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SUCCESS));
+ } else {
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SUCCESS_NEED_REBOOT));
+ }
+ break;
+ default:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_UNKNOWN), IccStatus );
+ break;
+ }
+
+ return IccStatus;
+}
+
+EFI_STATUS
+MessageBox (
+ IN UINT8 type,
+ OPTIONAL OUT UINT8* answer,
+ IN UINT16 StringId,
+ ...
+ )
+/*++
+Routine Description:
+ Wrapper function that displays messagebox. Text for Messagebox is specified with printf-like parameters.
+ Arguments:
+ type - messagebox type
+ answer - pointer to where user's answer will be stored
+ format, ... - parameters to printf
+Returns:
+--*/
+{
+ static AMI_POST_MANAGER_PROTOCOL* pAmiPostMgr = NULL;
+ EFI_GUID AmiPostManagerProtocolGuid = AMI_POST_MANAGER_PROTOCOL_GUID;
+ EFI_STATUS Status;
+ UINT8 LocalAnswer;
+ CHAR16* StrBuffer = 0;
+ CHAR16* LocalBuffer;
+ UINTN LocalBufferSize;
+ UINTN StrLen = 0;
+ va_list ArgList = va_start(ArgList,StringId);
+
+ if (pAmiPostMgr == NULL) {
+ Status = pBS->LocateProtocol(&AmiPostManagerProtocolGuid, NULL, &pAmiPostMgr);
+ ASSERT (pAmiPostMgr);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ HiiLibGetString(gHiiHandle, StringId, &StrLen, StrBuffer);
+ Status = pBS->AllocatePool(EfiBootServicesData, StrLen, &StrBuffer);
+ ASSERT_EFI_ERROR(Status);
+ HiiLibGetString(gHiiHandle, StringId, &StrLen, StrBuffer);
+
+ LocalBufferSize = (StrLen+1)*2;
+
+ while (1) {
+ Status = pBS->AllocatePool(EfiBootServicesData, LocalBufferSize, &LocalBuffer);
+ ASSERT_EFI_ERROR(Status);
+ if (LocalBufferSize <= Swprintf_s_va_list(LocalBuffer, LocalBufferSize, StrBuffer, ArgList) ) {
+ Status = pBS->FreePool(LocalBuffer);
+ ASSERT_EFI_ERROR(Status);
+ LocalBufferSize*=2;
+ } else {
+ break;
+ }
+ }
+
+ va_end(ArgList);
+
+ Status = pAmiPostMgr->DisplayMsgBox(L"Intel ICC", LocalBuffer, type, &LocalAnswer);
+ pBS->FreePool(StrBuffer);
+ pBS->FreePool(LocalBuffer);
+
+ ASSERT_EFI_ERROR (Status);
+ if (answer != NULL) {
+ *answer = LocalAnswer;
+ }
+ return Status;
+}
+
+ICC_LIB_STATUS
+EFIAPI
+IccInitOverclocking (
+ ICC_LIB_VERSION* Version
+ )
+/*++
+Routine Description:
+ Initializes ICC OverClocking and asks about initial clock-related data. The data is:
+ clock parameters from CURRENT record (will be displayed as current and boot-time frequencies)
+ clock parameters from FLASH record (needed in case we try to write flash record later)
+ clock ranges - max/min supported frequencies
+Arguments:
+
+Returns:
+ EFI_SUCCESS - if there were no errors, updates global variables
+ EFI_DEVICE_ERROR - if there were errors when interfacing ICC OverClocking
+
+--*/
+{
+ UINT8 i;
+ ICC_LIB_STATUS IccStatus;
+
+ gIccOverClockingProtocol->GetInfo(Version, &i, &IccStatus);
+
+ if (IccStatus != ICC_LIB_STATUS_SUCCESS) {
+ TRACE ((TRACE_ALWAYS, "(ICC) IccOverClocking failed to start. IccStatus=0x%x, version = %d.%d.%d.%d\n", IccStatus, Version->Major, Version->Minor, Version->Hotfix, Version->Build));
+ return IccStatus;
+ }
+
+ return 0;
+}
+
+VOID
+IccGetFrequencies (
+ IN UINT8 ClockNumber,
+ OUT CLOCK_DISPLAY_VALUES* Values
+ )
+/*++
+Routine Description:
+ Called by Setup module, feeds it with clock data required to display all clock related information on bios setup screen
+ Converts data from clock divider value to clock frequency
+Arguments:
+ ClockNumber - data for which clock should be returned
+Returns:
+ values - clock-related data required to display values on ICC setup screen
+--*/
+{
+ ICC_LIB_STATUS IccStatus;
+ ICC_CLOCK_RANGES ClockRange;
+ ICC_CLOCK_SETTINGS Clocksetting;
+
+ gIccOverClockingProtocol->GetClockRanges(ClockNumber, &ClockRange, &IccStatus);
+ Values->ClockUsage = (UINT16)ClockRange.UsageMask;
+ Values->ClkFreqMax = ClockRange.FrequencyMax/10000;
+ Values->ClkFreqMin = ClockRange.FrequencyMin/10000;
+ Values->SscChangeAllowed = (UINT8)ClockRange.SscChangeAllowed;
+ Values->SscModeCenterAvailable = (UINT8)ClockRange.SscCenterAllowed;
+ Values->SscModeUpAvailable = (UINT8)ClockRange.SscUpAllowed;
+ Values->SscModeDownAvailable = (UINT8)ClockRange.SscDownAllowed;
+ Values->SscPercentMax = (UINT16)ClockRange.SscPercentMax;
+
+ gIccOverClockingProtocol->GetCurrentClockSettings(ClockNumber, &Clocksetting, &IccStatus);
+ Values->ClkFreqCurrent = Clocksetting.Frequency/10000;
+ Values->SscPercentCurrent = (UINT16)Clocksetting.SscPercent;
+ Values->SscModeCurrent = SscModeToSscNumber(Clocksetting.SscMode);
+
+}
+
+UINT32
+SscNumberToSscMode (
+ IN UINT8 SscModeNumber
+ )
+/*++
+Routine Description:
+ Converts SSC mode description. ICC OverClocking uses 3 bit one-hot format.
+ For displaying things in BIOS setup, numeric value is more convenient
+ This function should be called 3 times, once for each bit in ICC OverClocking format.
+Arguments:
+ SscModeNumber - mode number from BIOS setup
+ Mode - particular mode we're checking for
+Returns:
+ 0 - SSC number does not represent Mode
+ 1 - SSC number represents Mode
+--*/
+{
+ switch(SscModeNumber)
+ {
+ case SSC_MODE_NONE:
+ return ICC_SSC_NONE;
+
+ case SSC_MODE_UP:
+ return ICC_SSC_UP;
+
+ case SSC_MODE_CENTER:
+ return ICC_SSC_CENTER;
+
+ case SSC_MODE_DOWN:
+ return ICC_SSC_DOWN;
+
+ default:
+ TRACE ((TRACE_ALWAYS, "(ICC) Invalid SscModeNumber value \n"));
+ EFI_DEADLOOP();
+ return 0;
+ }
+};
+
+UINT8
+SscModeToSscNumber (
+ IN UINT8 SscMode
+ )
+/*++
+Routine Description:
+ Converts SSC mode description. ICC OverClocking uses 3 bit one-hot format. BIOS setup requires 8bit numeric value.
+Arguments:
+ three bits from ICC OverClocking format
+Returns:
+ SSC mode in BIOS setup format
+--*/
+{
+ switch(SscMode)
+ {
+ case ICC_SSC_NONE:
+ return SSC_MODE_NONE;
+
+ case ICC_SSC_UP:
+ return SSC_MODE_UP;
+
+ case ICC_SSC_CENTER:
+ return SSC_MODE_CENTER;
+
+ case ICC_SSC_DOWN:
+ return SSC_MODE_DOWN;
+
+ default:
+ TRACE ((TRACE_ALWAYS, "(ICC) Invalid SscMode value \n"));
+ EFI_DEADLOOP();
+ return 0;
+ }
+}
+
+VOID
+SetIccPersistentData (
+ IN UINT8 FlowPhase
+)
+/*++
+Routine Description:
+ Sets ClocksModified field of IccPersistentData EFI variable
+Arguments:
+ new value of IccPersistentData
+Returns:
+ none
+--*/
+{
+
+ EFI_GUID IccPersistentDataGuid = ICC_PERSISTENT_DATA_GUID;
+ ICC_PERSISTENT_DATA IccPersistentData;
+
+ IccPersistentData.ClocksModified = FlowPhase;
+
+ pRS->SetVariable(
+ L"IccPersistentData",
+ &IccPersistentDataGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(IccPersistentData),
+ &IccPersistentData );
+}
+
+UINT8
+GetIccPersistentData (
+ VOID
+)
+/*++
+Routine Description:
+ Reads IccPersistentData EFI variable
+Arguments:
+ none
+Returns:
+ value of ClocksModified field
+--*/
+{
+ EFI_GUID IccPersistentDataGuid = ICC_PERSISTENT_DATA_GUID;
+ ICC_PERSISTENT_DATA IccPersistentData;
+ UINTN VariableSize;
+ EFI_STATUS Status;
+ VariableSize = sizeof(IccPersistentData);
+
+ Status = pRS->GetVariable(
+ L"IccPersistentData",
+ &IccPersistentDataGuid,
+ NULL,
+ &VariableSize,
+ &IccPersistentData );
+ if(EFI_ERROR(Status))
+ return ICC_SETTINGS_NOT_MODIFIED;
+ else
+ return IccPersistentData.ClocksModified;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h
new file mode 100644
index 0000000..24bae4c
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h
@@ -0,0 +1,167 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccCallbacks.h 3 10/30/12 8:37a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 10/30/12 8:37a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccCallbacks.h $
+//
+// 3 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 2 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 3 6/27/11 10:46p Klzhan
+// Update SscNumberToSscMode() for New Icc Control Library.
+//
+// 2 6/23/11 11:31p Klzhan
+// [TAG] EIP62129
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support ICC Control Library 8.0.0.19.
+// [Files] IccCallbacks.c, IccCallbacks.h
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccCallbacks.h
+//
+// Description: Setup hooks for ICC.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccCallbacks.h
+
+Abstract:
+
+ Setup hooks for ICC
+
+--*/
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+
+#define ICC_CLOCK_COUNT 8
+
+typedef struct _CLOCK_DISPLAY_VALUES {
+ UINT32 ClkFreqMax;
+ UINT32 ClkFreqMin;
+ UINT32 ClkFreqCurrent;
+ UINT16 SscPercentMax;
+ UINT16 SscPercentCurrent;
+ UINT16 ClockUsage;
+ UINT8 SscChangeAllowed;
+ UINT8 SscModeUpAvailable;
+ UINT8 SscModeCenterAvailable;
+ UINT8 SscModeDownAvailable;
+ UINT8 SscModeCurrent;
+ UINT8 DmiPegRatio;
+} CLOCK_DISPLAY_VALUES;
+
+typedef struct _ICC_CLK_REQUEST {
+ UINT16 Frequency;
+ UINT16 SscPercent;
+ UINT8 SscAllowed;
+ UINT8 SscMode;
+ UINT8 EveryBoot;
+} ICC_CLK_REQUEST;
+
+#define IMMEDIATE 0
+#define TEMPORARY 1
+#define PERMANENT 2
+
+#define SSC_MODE_NONE 3
+#define SSC_MODE_UP 2
+#define SSC_MODE_CENTER 1
+#define SSC_MODE_DOWN 0
+
+#define ROUND_UP 1
+#define ROUND_DOWN 0
+
+EFI_STATUS SendClockChangeRequest (IN ICC_VOLATILE_SETUP_DATA* IccSetupData, IN UINT8 ClkMask, IN UINT8 TypeOfChange);
+EFI_STATUS MessageBox (IN UINT8 type, OUT UINT8* answer, IN UINT16 StringId, ...);
+UINT16 FrequencyToDivider (IN UINT16 Frequency);
+UINT16 DividerToFrequency (IN UINT16 Divider);
+UINT16 FixDividerValue (IN UINT16 Divider, IN UINT8 Direction);
+UINT32 SscNumberToSscMode (IN UINT8 SscModeNumber);
+UINT8 SscModeToSscNumber (IN UINT8 SscMode);
+ICC_LIB_STATUS IccInitOverclocking (ICC_LIB_VERSION*);
+ICC_LIB_STATUS IccInvalidateRecord (IN UINT8 RecordType);
+VOID IccGetFrequencies (IN UINT8 ClockNumber, OUT CLOCK_DISPLAY_VALUES* values);
+EFI_STATUS IccRoundFrequency (IN OUT ICC_CLK_REQUEST* IccSetupData, IN UINT8 ClockNumber);
+ICC_LIB_STATUS IccSendRequestRecord (IN UINT8 TypeOfChange, IN UINT32 ClockMask, IN ICC_CLK_REQUEST* IccExchange, OUT UINT8* ErrorLocation);
+UINTN Wcslen(CHAR16 *string);
+CHAR16* Wcscpy(CHAR16 *string1, CHAR16* string2);
+VOID StrCat (IN OUT CHAR16 *Destination, IN CHAR16 *Source);
+VOID SetIccPersistentData (IN UINT8 FlowPhase);
+UINT8 GetIccPersistentData (VOID);
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c b/Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c
new file mode 100644
index 0000000..94c558f
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c
@@ -0,0 +1,141 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccLoadDefault.c 3 2/22/13 2:27a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 2/22/13 2:27a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccLoadDefault.c $
+//
+// 3 2/22/13 2:27a Klzhan
+// [TAG] EIP115268
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Icc Setup Item be hidden after load default(F3)
+// [RootCause] New TSE check gGrowserCallbackEnabled
+// [Solution] Enable gGrowserCallbackEnabled when call HiiSetBrowserData
+//
+// 2 4/24/12 12:31a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 5/04/11 3:08a Klzhan
+// EIP58767 : ICC Setup item will not be hidden when load default.
+//
+// 1 11/01/10 9:42a Tonywu
+// Fix that the "ICC OverClocking" form will be hidden when setup loads
+// defaults.
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IccLoadDefault.c
+//
+// Description: Enter when loaded default in SETUP.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+#include <Setup.h>
+#include <AmiLib.h>
+#include <AmiDxeLib.h>
+#include "IccSetup.h"
+
+EFI_STATUS FindVariableIndex(CHAR16 *Name, EFI_GUID *Guid, UINT32 *Index);
+
+extern BOOLEAN gBrowserCallbackEnabled;
+
+VOID IccSetupLoadDefault(VOID)
+{
+ UINT8 i;
+ EFI_STATUS Status;
+
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ ICC_VOLATILE_SETUP_DATA* TseIccSetupData = NULL;
+ BOOLEAN OrgBrowserCallbackEnabled = gBrowserCallbackEnabled;
+
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if (!EFI_ERROR(Status))
+ {
+ Status = pRS->GetVariable (
+ ICC_VOLATILE_SETUP_DATA_C_NAME,
+ &IccSetupDataGuid,
+ NULL,
+ &SelectionBufferSize,
+ IccSetupData);
+ ASSERT_EFI_ERROR(Status);
+ if (!EFI_ERROR(Status))
+ {
+ if (IccSetupData->AllowAdvancedOptions == 1)
+ {
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &TseIccSetupData);
+ if(EFI_ERROR(Status)) {
+ return;
+ }
+ gBrowserCallbackEnabled = TRUE;
+ Status = HiiLibGetBrowserData(&SelectionBufferSize,
+ TseIccSetupData,
+ &IccSetupDataGuid,
+ L"IccAdvancedSetupDataVar"
+ );
+ if(EFI_ERROR(Status))
+ {
+ pBS->FreePool(TseIccSetupData);
+ gBrowserCallbackEnabled = OrgBrowserCallbackEnabled;
+ return;
+ }
+
+ TseIccSetupData->AllowAdvancedOptions = IccSetupData->AllowAdvancedOptions;
+ for (i=0; i<6 ;i++)
+ {
+ TseIccSetupData->ShowClock[i] = IccSetupData->ShowClock[i];
+ TseIccSetupData->ShowSsc[i] = IccSetupData->ShowSsc[i];
+ TseIccSetupData->Frequency[i] = IccSetupData->Frequency[i];
+ TseIccSetupData->SscPercent[i] = IccSetupData->SscPercent[i];
+ }
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, TseIccSetupData,
+ &IccSetupDataGuid, L"IccAdvancedSetupDataVar");
+
+ pBS->FreePool(TseIccSetupData);
+ gBrowserCallbackEnabled = OrgBrowserCallbackEnabled;
+
+ }
+ }
+
+ }
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif
new file mode 100644
index 0000000..65e9d9f
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "IccSetup"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\IccSetup"
+ RefName = "IccSetup"
+[files]
+"IccSetup.mak"
+"IccSetup.sdl"
+"IccCallbacks.c"
+"IccCallbacks.h"
+"IccSetup.h"
+"IccSetupMenu.sd"
+"IccSetupSubmenu.sd"
+"IccStrings.uni"
+"IccLoadDefault.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h
new file mode 100644
index 0000000..69ae39d
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h
@@ -0,0 +1,139 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetup.h 4 10/30/12 8:37a Klzhan $
+//
+// $Revision: 4 $
+//
+// $Date: 10/30/12 8:37a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetup.h $
+//
+// 4 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 3 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 2 4/24/12 12:30a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccSetup.h
+//
+// Description: Setup hooks for ICC.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccSetup.h
+
+Abstract:
+
+ Setup hooks for ICC
+
+--*/
+#define SUPPORTED_CLOCKS 8
+
+//
+// Icc Persistent Data - needs to be remembered after platform power cycle
+//
+#define ICC_PERSISTENT_DATA_GUID \
+{0x64192dca, 0xd034, 0x49d2, 0xa6, 0xde, 0x65, 0xa8, 0x29, 0xeb, 0x4c, 0x74}
+
+#define ICC_PERSISTENT_DATA_C_NAME L"IccPersistentData"
+
+typedef struct _ICC_PERSISTENT_DATA {
+ UINT8 ClocksModified;
+} ICC_PERSISTENT_DATA;
+
+#define ICC_SETTINGS_NOT_MODIFIED 0
+#define ICC_SETTINGS_RECENTLY_MODIFIED 1
+#define ICC_SETTINGS_PREVIOUSLY_MODIFIED 2
+
+//
+// Icc Volatile Setup Data - volatile (to prevent flash wear) data used by TSE
+//
+#define ICC_VOLATILE_SETUP_DATA_GUID \
+{0x7b77fb8b, 0x1e0d, 0x4d7e, 0x95, 0x3f, 0x39, 0x80, 0xa2, 0x61, 0xe0, 0x77}
+
+#define ICC_VOLATILE_SETUP_DATA_C_NAME L"IccAdvancedSetupDataVar"
+#pragma pack(1)
+typedef struct _ICC_VOLATILE_SETUP_DATA {
+ UINT16 Frequency[SUPPORTED_CLOCKS];
+ UINT8 SscMode[SUPPORTED_CLOCKS];
+ UINT16 SscPercent[SUPPORTED_CLOCKS];
+ UINT8 ShowSsc[SUPPORTED_CLOCKS];
+ UINT8 ShowClock[SUPPORTED_CLOCKS];
+ UINT8 ShowDmiPegRatio[SUPPORTED_CLOCKS];
+ UINT8 DmiPegRatio[SUPPORTED_CLOCKS];
+ UINT8 ShowProfile;
+ UINT8 AllowAdvancedOptions;
+} ICC_VOLATILE_SETUP_DATA;
+#pragma pack()
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak
new file mode 100644
index 0000000..24d038e
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak
@@ -0,0 +1,99 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetup.mak 1 2/08/12 1:07a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:07a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetup.mak $
+#
+# 1 2/08/12 1:07a Klzhan
+# Initial Check in
+#
+# 2 5/04/11 3:06a Klzhan
+# EIP58767 : ICC setup items will not be hidden when load default.
+#
+# 1 2/25/11 1:42a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccSetup.mak
+#
+# Description: Makefile Setup hooks for ICC.
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+All :
+
+SetupSdbs : $(BUILD_DIR)\IccSetup.sdb
+
+SetupBin : $(BUILD_DIR)\IccCallbacks.obj
+
+$(BUILD_DIR)\IccSetup.mak : $(IccSetup_DIR)\$(@B).cif $(IccSetup_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IccSetup_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+$(BUILD_DIR)\IccSetup.sdb : $(BUILD_DIR)\IccSetup.mak $(IccSetup_DIR)\*.sd $(IccSetup_DIR)\*.uni
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\IccSetup.mak all\
+ TYPE=SDB NAME=IccSetup
+
+$(BUILD_DIR)\IccCallbacks.obj : $(IccSetup_DIR)\IccCallbacks.c
+ $(CC) $(CFLAGS)\
+ $(INTEL_MCH_INCLUDES) \
+ $(INTEL_PCH_INCLUDES) \
+ $(ME_INCLUDES)\
+ $(ICC_INCLUDES)\
+ $(NB_INCLUDES) \
+ $(WDT_APP_INCLUDES) \
+ /Fo$(BUILD_DIR)\ $(IccSetup_DIR)\IccCallbacks.c
+
+#---------------------------------------------------------------------------
+# Icc SETUP load dafault hook
+#---------------------------------------------------------------------------
+AMITSEBin : $(BUILD_DIR)\IccLoadDefault.obj
+
+IccLoadDefault_CFLAGS=$(CFLAGS) \
+ -I $(TSEBIN_DIR)\Inc \
+ -I $(TSEBIN_DIR)
+
+$(BUILD_DIR)\IccLoadDefault.obj : $(IccSetup_DIR)\IccLoadDefault.c
+ $(CC) $(IccLoadDefault_CFLAGS) /Fo$(BUILD_DIR)\IccLoadDefault.obj $(IccSetup_DIR)\IccLoadDefault.c
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl
new file mode 100644
index 0000000..a4ef233
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl
@@ -0,0 +1,263 @@
+TOKEN
+ Name = "IccSetup_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable ICC support in Project in DXE Phase"
+End
+
+MODULE
+ Help = "Includes IccSetup.mak to Project"
+ File = "IccSetup.mak"
+End
+
+PATH
+ Name = "IccSetup_DIR"
+ Help = "Icc Setup dir"
+End
+
+ELINK
+ Name = "/I$(IccSetup_DIR)"
+ Parent = "ICC_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccSetup.sdb"
+ Parent = "SETUP_SDBS"
+ Priority = 86
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(IccSetup_DIR)\IccSetupMenu.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 86
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(IccSetup_DIR)\IccSetupSubmenu.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 86
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "InitICCStrings,"
+ Parent = "SetupStringInit"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_ICCMENU,IccMenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM1,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM2,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM3,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM4,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM5,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM6,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM7,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM8,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW1,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW2,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW3,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW4,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW5,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW6,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW7,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW8,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM1,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM2,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM3,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM4,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM5,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM6,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM7,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM8,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ1,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ2,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ3,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ4,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ5,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ6,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ7,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ8,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccLoadDefault.obj"
+ Parent = "AMITSE_Objects"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "IccSetupLoadDefault,"
+ Parent = "LoadSetupDefaults,"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd
new file mode 100644
index 0000000..06ed9f7
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd
@@ -0,0 +1,438 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetupMenu.sd 4 12/24/12 6:37a Klzhan $
+//
+// $Revision: 4 $
+//
+// $Date: 12/24/12 6:37a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetupMenu.sd $
+//
+// 4 12/24/12 6:37a Klzhan
+// [TAG] EIP109624
+// [Category] New Feature
+// [Description] Support Lock Icc registers.
+//
+// 3 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 2 4/24/12 12:31a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccSetup.sd
+//
+// Description: SD file for ICC Setup
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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.
+
+Module Name:
+
+ IccSetupMenu.sd
+
+Abstract:
+
+ Icc's advanced menu layout
+
+--*/
+
+#ifdef SETUP_DATA_DEFINITION
+
+ UINT8 IccWdtEnabled;
+ UINT8 IccSetClockEnables;
+ UINT8 IccLockRegisters;
+ UINT8 IccDisplayProfile;
+ UINT8 IccSelectedProfile;
+ UINT8 IccProfileEnable;
+
+#endif
+
+#ifdef CONTROL_DEFINITION
+ #define ICC_GOTO_INTELICC\
+ goto ICC_FORM_ID, \
+ prompt = STRING_TOKEN(STR_ICC_FORM),\
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),\
+ flags = INTERACTIVE,\
+ key = AUTO_ID(KEY_ICCMENU);
+#endif
+#ifdef ADVANCED_FORM_SET
+
+#ifdef FORM_SET_TYPEDEF
+
+#include "IccSetup.h"
+
+#endif
+
+
+#ifdef FORM_SET_VARSTORE
+
+ varstore ICC_VOLATILE_SETUP_DATA,
+ key = AUTO_ID(ICC_VOLATILE_SETUP_DATA_VAR),
+ name = IccAdvancedSetupDataVar,
+ guid = ICC_VOLATILE_SETUP_DATA_GUID;
+
+#endif
+
+#ifdef FORM_SET_ITEM
+#endif
+
+#ifdef FORM_SET_GOTO
+ //
+ // this grayout is always false, but ensures that callback function will receive pointer to ICC_VOLATILE_SETUP_DATA instead SETUP_DATA
+ //
+ grayoutif ideqval ICC_VOLATILE_SETUP_DATA.AllowAdvancedOptions == 2;
+ ICC_GOTO_INTELICC
+ endif;
+#endif
+
+#ifdef FORM_SET_FORM
+ #ifndef ICC_FORM_SETUP
+ #define ICC_FORM_SETUP
+
+ form formid = AUTO_ID(ICC_FORM_ID),
+ title = STRING_TOKEN(STR_ENABLED);
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ oneof varid = SETUP_DATA.IccWdtEnabled,
+ prompt = STRING_TOKEN(STR_ICC_WDT_ENABLE),
+ help = STRING_TOKEN(STR_ICC_WDT_ENABLE_HELP),
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = RESET_REQUIRED;
+ endoneof;
+
+ oneof varid = SETUP_DATA.IccSetClockEnables,
+ prompt = STRING_TOKEN(STR_ICC_CLOCK_ENABLING),
+ help = STRING_TOKEN(STR_ICC_CLOCK_ENABLING_HELP),
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+ endoneof;
+
+ oneof varid = SETUP_DATA.IccLockRegisters,
+ prompt = STRING_TOKEN(STR_ICC_LOCK_EOP),
+ help = STRING_TOKEN(STR_ICC_LOCK_HELP),
+ option text = STRING_TOKEN(STR_ICC_DEFAULT), value = 3, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ICC_LOCK), value = 4, flags = MANUFACTURING | RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ICC_UNLOCK), value = 5, flags = RESET_REQUIRED;
+ endoneof;
+ endif;
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval SETUP_DATA.IccDisplayProfile == 0;
+ numeric varid = SETUP_DATA.IccSelectedProfile,
+ prompt = STRING_TOKEN(STR_ICC_PROFILE),
+ help = STRING_TOKEN(STR_ICC_PROFILE_HELP),
+ flags = RESET_REQUIRED,
+ minimum = 0,
+ maximum = 7,
+ step = 1,
+ default = 0,
+ endnumeric;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ SEPARATOR
+
+ SUBTITLE(STRING_TOKEN(STR_ICC_OVERCLOCKING))
+
+ SEPARATOR
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_LIB_VERSION),
+ text = STRING_TOKEN(STR_ICC_LIB_VERSION_NR),
+ flags = 0, key = AUTO_ID(KEY_ACCEPT);
+
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.AllowAdvancedOptions == 0;
+
+ goto ICC_ADVFORM_ID1,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM1),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM1);
+
+ goto ICC_ADVFORM_ID2,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM2),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM2);
+
+ goto ICC_ADVFORM_ID3,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM3),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM3);
+
+ goto ICC_ADVFORM_ID4,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM4),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM4);
+
+ goto ICC_ADVFORM_ID5,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM5),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM5);
+
+ goto ICC_ADVFORM_ID6,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM6),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM6);
+
+ goto ICC_ADVFORM_ID7,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM7),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM7);
+
+ goto ICC_ADVFORM_ID8,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM8),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM8);
+ endif;
+
+ endform;
+
+#define INSIDE_ICC_SUBMENU
+
+#define CLOCK_NUMBER OFFSET_0
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ1)
+AUTO_ID(KEY_CHANGE_NOW1)
+AUTO_ID(KEY_CHANGE_ONCE1)
+AUTO_ID(KEY_CHANGE_PERM1)
+#endif
+#define KEY_FREQ KEY_FREQ1
+#define MENU_NUMBER ICC_ADVFORM_ID1
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW1
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE1
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM1
+form formid = AUTO_ID(ICC_ADVFORM_ID1),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_1
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ2)
+AUTO_ID(KEY_CHANGE_NOW2)
+AUTO_ID(KEY_CHANGE_ONCE2)
+AUTO_ID(KEY_CHANGE_PERM2)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ2
+#define MENU_NUMBER ICC_ADVFORM_ID2
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW2
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE2
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM2
+form formid = AUTO_ID(ICC_ADVFORM_ID2),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_2
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ3)
+AUTO_ID(KEY_CHANGE_NOW3)
+AUTO_ID(KEY_CHANGE_ONCE3)
+AUTO_ID(KEY_CHANGE_PERM3)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ3
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW3
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE3
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM3
+#define MENU_NUMBER ICC_ADVFORM_ID3
+form formid = AUTO_ID(ICC_ADVFORM_ID3),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_3
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ4)
+AUTO_ID(KEY_CHANGE_NOW4)
+AUTO_ID(KEY_CHANGE_ONCE4)
+AUTO_ID(KEY_CHANGE_PERM4)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ4
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW4
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE4
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM4
+#define MENU_NUMBER ICC_ADVFORM_ID4
+form formid = AUTO_ID(ICC_ADVFORM_ID4),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_4
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ5)
+AUTO_ID(KEY_CHANGE_NOW5)
+AUTO_ID(KEY_CHANGE_ONCE5)
+AUTO_ID(KEY_CHANGE_PERM5)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ5
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW5
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE5
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM5
+#define MENU_NUMBER ICC_ADVFORM_ID5
+form formid = AUTO_ID(ICC_ADVFORM_ID5),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_5
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ6)
+AUTO_ID(KEY_CHANGE_NOW6)
+AUTO_ID(KEY_CHANGE_ONCE6)
+AUTO_ID(KEY_CHANGE_PERM6)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ6
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW6
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE6
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM6
+#define MENU_NUMBER ICC_ADVFORM_ID6
+form formid = AUTO_ID(ICC_ADVFORM_ID6),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_6
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ7)
+AUTO_ID(KEY_CHANGE_NOW7)
+AUTO_ID(KEY_CHANGE_ONCE7)
+AUTO_ID(KEY_CHANGE_PERM7)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ7
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW7
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE7
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM7
+#define MENU_NUMBER ICC_ADVFORM_ID7
+form formid = AUTO_ID(ICC_ADVFORM_ID7),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_7
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ8)
+AUTO_ID(KEY_CHANGE_NOW8)
+AUTO_ID(KEY_CHANGE_ONCE8)
+AUTO_ID(KEY_CHANGE_PERM8)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ8
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW8
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE8
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM8
+#define MENU_NUMBER ICC_ADVFORM_ID8
+form formid = AUTO_ID(ICC_ADVFORM_ID8),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#undef INSIDE_ICC_SUBMENU
+
+ #endif // ICC_FORM_SETUP
+
+#endif
+
+#endif
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd
new file mode 100644
index 0000000..0ebcfab
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd
@@ -0,0 +1,239 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd 3 11/20/12 3:09a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 11/20/12 3:09a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd $
+//
+// 3 11/20/12 3:09a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] AMI CSP Intel BIOS Setup Unify Rule.
+//
+// 2 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 2 9/06/11 6:11a Klzhan
+// [TAG] EIP67462
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC 08.00.00.022.1
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccSetup.sd
+//
+// Description: SD file for ICC Setup
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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.
+
+Module Name:
+
+ IccSetupSubmenu.sd
+
+Abstract:
+
+ Icc's overclocking submenu layout
+
+--*/
+
+//This file should be included multiple times into IccSetupMenu.sd
+
+#ifdef INSIDE_ICC_SUBMENU
+
+title = STRING_TOKEN(STR_EMPTY);
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CLOCK_NUMBER),
+ text = STRING_TOKEN(STR_EMPTY),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CLOCK_USAGE_1),
+ text = STRING_TOKEN(STR_EMPTY),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CLOCK_USAGE_2),
+ text = STRING_TOKEN(STR_EMPTY),
+ flags = 0, key = 0;
+
+ SEPARATOR
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_MAX_FREQUENCY),
+ text = STRING_TOKEN(STR_ICC_MAX_FREQUENCY_VALUE),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_MIN_FREQUENCY),
+ text = STRING_TOKEN(STR_ICC_MIN_FREQUENCY_VALUE),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY),
+ text = STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY_VALUE),
+ flags = 0, key = 0;
+
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowClock[CLOCK_NUMBER] == 0;
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ numeric varid = ICC_VOLATILE_SETUP_DATA.Frequency[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_ICC_NEW_FREQUENCY),
+ help = STRING_TOKEN(STR_ICC_NEW_FREQUENCY_HELP),
+ flags = INTERACTIVE,
+ key = KEY_FREQ,
+ minimum = 0,
+ maximum = 65535,
+ step = 1,
+ default = 0,
+ endnumeric;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_MODES),
+ text = STRING_TOKEN(STR_ICC_SSC_MODES_VALUE),
+ flags = 0, key = 0;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE_VALUE),
+ flags = 0, key = 0;
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ oneof varid = ICC_VOLATILE_SETUP_DATA.SscMode[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_ICC_SSC_MODE_SELECTION),
+ help = STRING_TOKEN(STR_ICC_SSC_MODE_SELECTION_HELP),
+ option text = STRING_TOKEN(STR_ICC_MODE_DOWN), value = 0, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_ICC_MODE_CENTRE), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_ICC_MODE_UP), value = 2, flags = 0;
+ endoneof;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_MAX),
+ text = STRING_TOKEN(STR_ICC_SSC_MAX_VALUE),
+ flags = 0, key = 0;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT_VALUE),
+ flags = 0, key = 0;
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ numeric varid = ICC_VOLATILE_SETUP_DATA.SscPercent[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_ICC_SSC_NEW_PERCENT),
+ help = STRING_TOKEN(STR_ICC_SSC_NEW_PERCENT_HELP),
+ flags = 0,
+ key = 0,
+ minimum = 0,
+ maximum = 999,
+ step = 1,
+ default = 0,
+ endnumeric;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowDmiPegRatio[CLOCK_NUMBER] == 0;
+ oneof varid = ICC_VOLATILE_SETUP_DATA.DmiPegRatio[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_DMI_PEG_RATIO),
+ help = STRING_TOKEN(STR_DMI_PEG_RATIO_HELP),
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_55), value = 0, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_54), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_53), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_52), value = 3, flags = 0;
+ endoneof;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0 AND ideqval ICC_VOLATILE_SETUP_DATA.ShowClock[CLOCK_NUMBER] == 0;
+ goto MENU_NUMBER,prompt=STRING_TOKEN(STR_ICC_IMMEDIATE_CHANGES),help=STRING_TOKEN(STR_ICC_IMMEDIATE_CHANGES_HELP),flags=INTERACTIVE,key=KEY_CHANGE_NOW;
+ goto MENU_NUMBER,prompt=STRING_TOKEN(STR_ICC_PERMANENT_CHANGES),help=STRING_TOKEN(STR_ICC_PERMANENT_CHANGES_HELP),flags=INTERACTIVE,key=KEY_CHANGE_PERM;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ endform;
+
+#endif
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/IccSetup/IccStrings.uni b/Board/EM/MeWrapper/Icc/IccSetup/IccStrings.uni
new file mode 100644
index 0000000..29f0557
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccStrings.uni
Binary files differ
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif
new file mode 100644
index 0000000..b548eaf
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "IccOverClocking"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\OverClocking\"
+ RefName = "IccOverClocking"
+[files]
+"IccOverClocking.sdl"
+"IccOverClocking.dxs"
+"IccOverClocking.mak"
+"IccOverClocking.efi"
+"IccOverClocking9_5.dxs"
+"IccOverClocking9_5.efi"
+"IccProtocol.h"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs
new file mode 100644
index 0000000..06ebd96
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs
@@ -0,0 +1,109 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.dxs 2 12/04/12 4:39a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 12/04/12 4:39a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.dxs $
+//
+// 2 12/04/12 4:39a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+// [Files] IccOverClocking.sdl
+// IccOverClocking.dxs
+// IccOverClocking.mak
+// IccOverClocking.efi
+// IccOverClocking.cif
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.dxs
+//
+// Description: Icc control library.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccOverClocking.dxs
+
+Abstract:
+
+ Icc control library
+
+--*/
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#ifdef CougarPoint_SUPPORT
+#include EFI_PROTOCOL_DEFINITION (Wdt)
+#endif
+#include "IccProtocol.h"
+DEPENDENCY_START
+#ifdef CougarPoint_SUPPORT
+ WDT_PROTOCOL_GUID AND
+#endif
+ EFI_HECI_PROTOCOL_GUID
+ AND
+ ICC_9_0_GUID
+DEPENDENCY_END
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efi b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efi
new file mode 100644
index 0000000..237ad24
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efi
Binary files differ
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak
new file mode 100644
index 0000000..732fa52
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak
@@ -0,0 +1,111 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.mak 2 1/18/13 12:31a Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 1/18/13 12:31a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.mak $
+#
+# 2 1/18/13 12:31a Klzhan
+# [TAG] EIPNone
+# [Category] Bug Fix
+# [Symptom] ICC library not loaded when ME 9.5
+# [Files] IccOverClocking.sdl
+# IccOverClocking.dxs
+# IccOverClocking.mak
+# IccOverClocking.efi
+# IccOverClocking9_5.dxs
+# IccOverClocking9_5.efi
+# IccProtocol.h
+# IccOverClocking.cif
+#
+# 1 2/08/12 1:07a Klzhan
+# Initial Check in
+#
+# 2 9/26/11 6:21a Klzhan
+# Fix build error with New EDK
+#
+# 1 2/25/11 1:42a Klzhan
+# Initial Check-in
+#
+# 2 12/03/10 5:37a Klzhan
+# Fix Build Error.
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccOverClocking.mak
+#
+# Description: Setup hooks for ICC.
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : $(BUILD_DIR)\IccOverClocking.ffs $(BUILD_DIR)\IccOverClocking9_5.ffs
+
+IccOverClocking_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(ICC_INCLUDES)\
+
+$(BUILD_DIR)\IccOverClocking.ffs : $(IccOverClocking_DIR)\$(@B).efi $(IccOverClocking_DIR)\$(@B).mak Core\FFS.mak
+ $(MAKE) /$(MAKEFLAGS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(IccOverClocking_INCLUDES)" \
+ BUILD_DIR=$(BUILD_DIR) SOURCE_DIR=$(IccOverClocking_DIR) \
+ GUID=5BBA83E5-F027-4ca7-BFD0-16358CC9E123\
+ NAME=$(@B)\
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(IccOverClocking_DIR)\IccOverClocking.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$(IccOverClocking_DIR)\$(@B).efi FFSFILE=$@ COMPRESS=1 \
+
+
+$(BUILD_DIR)\IccOverClocking9_5.ffs : $(IccOverClocking_DIR)\IccOverClocking9_5.efi $(IccOverClocking_DIR)\IccOverClocking.mak Core\FFS.mak
+ $(MAKE) /$(MAKEFLAGS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(IccOverClocking_INCLUDES)" \
+ BUILD_DIR=$(BUILD_DIR) SOURCE_DIR=$(IccOverClocking_DIR) \
+ GUID=8e68e3c5-fc59-4280-8467-3800d31a8162\
+ NAME=$(@B)\
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(IccOverClocking_DIR)\IccOverClocking9_5.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$(IccOverClocking_DIR)\$(@B).efi FFSFILE=$@ COMPRESS=1 \
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl
new file mode 100644
index 0000000..782cb57
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "IccOverClocking_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IccOverClocking support in Project"
+End
+
+MODULE
+ Help = "Includes IccOverClocking.mak to Project"
+ File = "IccOverClocking.mak"
+End
+
+PATH
+ Name = "IccOverClocking_DIR"
+ Help = "Icc Support commands"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccOverClocking.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccOverClocking9_5.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs
new file mode 100644
index 0000000..be16aac
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs
@@ -0,0 +1,101 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking9_5.dxs 1 12/04/12 4:42a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 12/04/12 4:42a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking9_5.dxs $
+//
+// 1 12/04/12 4:42a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.dxs
+//
+// Description: Icc control library.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccOverClocking.dxs
+
+Abstract:
+
+ Icc control library
+
+--*/
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#ifdef CougarPoint_SUPPORT
+#include EFI_PROTOCOL_DEFINITION (Wdt)
+#endif
+#include "IccProtocol.h"
+DEPENDENCY_START
+#ifdef CougarPoint_SUPPORT
+ WDT_PROTOCOL_GUID AND
+#endif
+ EFI_HECI_PROTOCOL_GUID
+ AND
+ ICC_9_5_GUID
+DEPENDENCY_END
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efi b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efi
new file mode 100644
index 0000000..43dd6e3
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efi
Binary files differ
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h b/Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h
new file mode 100644
index 0000000..4d4f106
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h
@@ -0,0 +1,67 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccProtocol.h 1 12/04/12 4:46a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 12/04/12 4:46a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccProtocol.h $
+//
+// 1 12/04/12 4:46a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccProtocol.h
+//
+// Description: Protocol GUID define.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _ICC_PROTOCOL_H_
+#define _ICC_PROTOCOL_H_
+
+#define ICC_9_0_GUID \
+ {0xAE4BD7F4, 0xB58F, 0x4D12, 0xBC, 0xC4, 0x98, 0x4, 0xD7, 0x55, 0xCF, 0x42}
+
+#define ICC_9_5_GUID \
+ {0x33DDC8EC, 0x20D2, 0x45C6, 0x9C, 0xB0, 0x5D, 0x7A, 0xC6, 0xCA, 0x10, 0x8C}
+
+#endif
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c
new file mode 100644
index 0000000..e26e236
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c
@@ -0,0 +1,98 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.c 1 2/08/12 1:05a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:05a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.c $
+//
+// 1 2/08/12 1:05a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.c
+//
+// Description: ICC OverClocking protocol
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+
+Module Name:
+
+ IccOverClocking.c
+
+Abstract:
+
+ ICC OverClocking protocol
+
+--*/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "IccOverClocking.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gIccOverClockingProtocolGuid = ICC_OVERCLOCKING_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gIccOverClockingProtocolGuid, "ICC OverClocking Protocol", "Integrated Clock Control OverClocking Protocol");
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h
new file mode 100644
index 0000000..8dc0baa
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h
@@ -0,0 +1,278 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.h 3 5/14/12 4:45a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 5/14/12 4:45a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.h $
+//
+// 3 5/14/12 4:45a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC library
+//
+// 2 5/11/12 3:37a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update New ICC library 9.0.0.5
+//
+// 1 2/08/12 1:05a Klzhan
+// Initial Check in
+//
+// 3 9/06/11 6:09a Klzhan
+// [TAG] EIP67462
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC 08.00.00.022.1
+//
+// 2 6/23/11 11:29p Klzhan
+// [TAG] EIP62129
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC control Library to 8.0.0.19.
+// [Files] IccOverClocking.efi, IccOverClocking.h
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.h
+//
+// Description: ICC OverClocking protocol
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+ Any software source code reprinted in this document is furnished under
+ a software license and may only be used or copied in accordance with
+ the terms of that license.
+
+
+ Copyright 2010-2011, Intel Corporation. All rights reserved.
+
+--*/
+
+#ifndef _ICC_OVERCLOCKING_H_
+#define _ICC_OVERCLOCKING_H_
+
+/* Types used by ICC LIB */
+
+typedef enum _ICC_LIB_STATUS
+{
+ ICC_LIB_STATUS_SUCCESS, // 0
+ ICC_LIB_STATUS_INVALID_PARAMS, // 1
+ ICC_LIB_STATUS_INVALID_CLOCK_NUMBER, // 2
+ ICC_LIB_STATUS_CLOCK_NOT_FOUND, // 3
+ ICC_LIB_STATUS_INVALID_FREQ_VALUE, // 4
+ ICC_LIB_STATUS_FREQ_TOO_LOW, // 5
+ ICC_LIB_STATUS_FREQ_TOO_HIGH, // 6
+ ICC_LIB_STATUS_FREQ_MUST_HAVE_ZERO_SSC, // 7
+ ICC_LIB_STATUS_SSC_CHANGE_NOT_ALLOWED, // 8
+ ICC_LIB_STATUS_INVALID_SSC_MODE, // 9
+ ICC_LIB_STATUS_SSC_MODE_NOT_SUPPORTED, // a
+ ICC_LIB_STATUS_SSC_OUT_OF_RANGE, // b
+ ICC_LIB_STATUS_SSC_TOO_HIGH, // c
+ ICC_LIB_STATUS_SSC_TOO_LOW, // d
+ ICC_LIB_STATUS_SSC_CHANGE_NOT_ALLOWED_SSC_DISABLED, // e
+ ICC_LIB_STATUS_DYNAMIC_CHANGE_NOT_ALLOWED, // f
+ ICC_LIB_STATUS_INVALID_DMI_PEG_RATIO, // 10
+ ICC_LIB_STATUS_REGISTER_IS_LOCKED, // 11
+ ICC_LIB_STATUS_MEI_INITIALIZATION_FAILED, // 12
+ ICC_LIB_STATUS_MEI_CONNECTION_FAILED, // 13
+ ICC_LIB_STATUS_UNEXPECTED_FW_ERROR, // 14
+ ICC_LIB_STATUS_UNSUPPORTED_HW, // 15
+ ICC_LIB_STATUS_CLOCK_DISABLED_FAILED_PROGRAMMING, // 16
+ ICC_LIB_STATUS_FREQ_AND_SSC_NOT_MATCH, // 17
+ ICC_LIB_STATUS_WAITING_FOR_WARM_RESET, // 18
+ ICC_LIB_STATUS_NOT_ALLOWED_IN_USER_MODE, // 19
+ ICC_LIB_STATUS_TOO_MANY_CONNECTIONS, // 1a
+ ICC_LIB_STATUS_INVALID_COOKIE, // 1b
+ ICC_LIB_STATUS_DMI_PEG_RATIO_CHANGE_NOT_ALLOWED, // 1c
+ ICC_LIB_STATUS_NO_USAGE_DEFINED_FOR_THE_CLOCK, // 1d
+ ICC_LIB_STATUS_DATA_NOT_AVAILABLE, // 1e
+
+ ICC_LIB_STATUS_UNSPECIFIED_ERROR = 0xFFFF
+} ICC_LIB_STATUS;
+
+ typedef enum _ICC_CLOCK_USAGE
+ {
+ ICC_CLOCK_USAGE_BCLK = 0,
+ ICC_CLOCK_USAGE_DMI,
+ ICC_CLOCK_USAGE_PEG,
+ ICC_CLOCK_USAGE_PCIE,
+ ICC_CLOCK_USAGE_PCI33,
+ ICC_CLOCK_USAGE_RESERVED,
+ ICC_CLOCK_USAGE_SATA,
+ ICC_CLOCK_USAGE_USB3,
+ ICC_CLOCK_USAGE_DISPLAY,
+ ICC_CLOCK_USAGE_DISPLAY_NON_SPREAD,
+ ICC_CLOCK_USAGE_27MHZ_DOWN_GFX,
+ ICC_CLOCK_USAGE_DISPLAY_VGA,
+ ICC_CLOCK_USAGE_USB_LEGACY,
+ ICC_CLOCK_USAGE_14_31818_MHZ
+ } ICC_CLOCK_USAGE;
+
+// @brief Defines a generic version structure used in the software build process.
+typedef struct _ICC_LIB_VERSION
+{
+ UINT16 Major;
+ UINT16 Minor;
+ UINT16 Hotfix;
+ UINT16 Build;
+} ICC_LIB_VERSION;
+
+// ssc mode
+typedef enum _ICC_SSC_MODE
+ {
+ ICC_SSC_NONE = 0, // if used in SET, it means DONT CARE and current percent
+ // value will be used regardless of percent value
+ ICC_SSC_UP = 1,
+ ICC_SSC_CENTER = 2,
+ ICC_SSC_DOWN = 4
+} ICC_SSC_MODE;
+
+typedef UINT32 ICC_CLOCK_FREQUENCY;
+
+// Ratio used to modify the BCLK value and to produce
+// the PEG Slot Frequency (~100MHz). BCLK / ratio = PEG
+// Used in HW where the BCLK, DMI, & PEG use a common clock
+typedef enum _ICC_DMI_PEG_RATIO
+{
+ ICC_DMI_PEG_RATIO_5_TO_5 = 0, //< 5/5 = 1 - 1:1 ratio used when BCLK at 100MHz
+ ICC_DMI_PEG_RATIO_5_TO_4, //< 5/4 = 1.25 - Used when BCLK around 125MHz
+ ICC_DMI_PEG_RATIO_5_TO_3, //< 5/3 = 1.66 - Used when BCLK around 166MHz
+ ICC_DMI_PEG_RATIO_5_TO_2 //< 5/2 = 2.5 - Used when BCLK around 250MHz
+} ICC_DMI_PEG_RATIO;
+
+typedef struct _ICC_CLOCK_SETTINGS
+{
+ ICC_CLOCK_FREQUENCY Frequency;
+ ICC_SSC_MODE SscMode;
+ UINT8 SscPercent; // encoding example: 1.28% -> SSC_SPREAD value is 128
+ ICC_DMI_PEG_RATIO DmiPegRatio;
+} ICC_CLOCK_SETTINGS;
+
+typedef UINT16 ICC_CLOCK_USAGE_MASK;
+
+typedef struct _ICC_CLOCK_RANGES
+{
+ ICC_CLOCK_FREQUENCY FrequencyMin;
+ ICC_CLOCK_FREQUENCY FrequencyMax;
+ UINT8 SscChangeAllowed;
+ UINT8 SscUpAllowed;
+ UINT8 SscCenterAllowed;
+ UINT8 SscDownAllowed;
+ UINT8 SscPercentMax;
+ // that field is actually still a bit mask, but usually applications will never use it.
+ ICC_CLOCK_USAGE_MASK UsageMask;
+ UINT8 SscHaltAllowed;
+} ICC_CLOCK_RANGES;
+
+typedef UINT8 ICC_CLOCK_ID;
+
+typedef UINT32 ICC_CLOCK_ID_MASK;
+
+typedef enum _ICC_RECORD_INVALIDATION_REASON
+{
+ ICC_LIB_RIR_RECORD_VALID = 0,
+ ICC_LIB_RIR_AC_POWER_LOSS,
+ ICC_LIB_RIR_CMOS_BATTERY_REMOVED,
+ ICC_LIB_RIR_PLATFORM_BOOT_TIMEOUT,
+ ICC_LIB_RIR_WDT_EXPIRED,
+ ICC_LIB_RIR_RESERVED,
+ ICC_LIB_RIR_INVALIDATE_BY_REQUEST,
+ ICC_LIB_RIR_FW_BUG
+} ICC_RECORD_INVALIDATION_REASON;
+
+//
+// GUID for the ICC OverClocking Protocol
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define ICC_OVERCLOCKING_PROTOCOL_GUID \
+ {0x8e8cbc58, 0x834c, 0x41e3, 0xb8, 0xca, 0xf0, 0x0c, 0xcf, 0x5a, 0x71, 0x7c}
+
+#else
+
+#define ICC_OVERCLOCKING_PROTOCOL_GUID \
+ {0x8e8cbc58, 0x834c, 0x41e3, { 0xb8, 0xca, 0xf0, 0x0c, 0xcf, 0x5a, 0x71, 0x7c } }
+
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gIccOverClockingProtocolGuid;
+
+typedef VOID (EFIAPI *ICC_LIB_GET_INFO) (ICC_LIB_VERSION*, UINT8*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_CLOCK_ID) (ICC_CLOCK_USAGE, ICC_CLOCK_ID_MASK*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_CLOCK_RANGES) (ICC_CLOCK_ID, ICC_CLOCK_RANGES*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_CURRENT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_SET_CURRENT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_BOOT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_SET_BOOT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_DEFAULT_BOOT_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_RESET_CLOCK_BOOT_SETTINGS_TO_DEFAULTS) (ICC_CLOCK_ID, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_RESET_ALL_CLOCKS_BOOT_SETTINGS_TO_DEFAULTS) (ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_GET_NEXT_FREQUENCY) (ICC_CLOCK_ID, ICC_CLOCK_FREQUENCY, ICC_CLOCK_FREQUENCY*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_GET_PREVIOUS_FREQUENCY) (ICC_CLOCK_ID, ICC_CLOCK_FREQUENCY, ICC_CLOCK_FREQUENCY*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_BOOT_CLOCK_SETTINGS_INVALIDATION_REASON) (ICC_RECORD_INVALIDATION_REASON*, ICC_LIB_STATUS*);
+
+
+typedef struct _ICC_OVERCLOCKING_PROTOCOL {
+ ICC_LIB_GET_INFO GetInfo;
+ ICC_LIB_GET_CLOCK_ID GetClockId;
+ ICC_LIB_GET_CLOCK_RANGES GetClockRanges;
+ ICC_LIB_GET_CURRENT_CLOCK_SETTINGS GetCurrentClockSettings;
+ ICC_LIB_SET_CURRENT_CLOCK_SETTINGS SetCurrentClockSettings;
+ ICC_LIB_GET_BOOT_CLOCK_SETTINGS GetBootClockSettings;
+ ICC_LIB_SET_BOOT_CLOCK_SETTINGS SetBootClockSettings;
+ ICC_LIB_GET_DEFAULT_BOOT_SETTINGS GetDefaultClockSettings;
+ ICC_LIB_RESET_CLOCK_BOOT_SETTINGS_TO_DEFAULTS ResetClockBootSettingsToDefaults;
+ ICC_LIB_RESET_ALL_CLOCKS_BOOT_SETTINGS_TO_DEFAULTS ResetAllClocksBootSettingsToDefaults;
+ ICC_GET_NEXT_FREQUENCY GetNextFrequency;
+ ICC_GET_PREVIOUS_FREQUENCY GetPreviousFrequency;
+ ICC_LIB_GET_BOOT_CLOCK_SETTINGS_INVALIDATION_REASON GetBootClockSettingsInvalidationReason;
+} ICC_OVERCLOCKING_PROTOCOL;
+
+#endif /* _ICC_OVERCLOCKING_H_ */
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif
new file mode 100644
index 0000000..178021d
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "IccProtocolLib"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\Protocol"
+ RefName = "IccProtocolLib"
+[files]
+"IccProtocolLib.sdl"
+"IccProtocolLib.mak"
+"IccOverClocking\IccOverClocking.h"
+"IccOverClocking\IccOverClocking.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak
new file mode 100644
index 0000000..3eb9b6b
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak
@@ -0,0 +1,78 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccProtocolLib.mak 1 2/08/12 1:05a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:05a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccProtocolLib.mak $
+#
+# 1 2/08/12 1:05a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:41a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccProtocolLib.mak
+#
+# Description: MakeFile for IccProtocolLib
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : IccProtocolLib
+
+$(IccProtocol_LIB) : IccProtocolLib
+
+IccProtocolLib : $(BUILD_DIR)\IccProtocolLib.mak IccProtocolLibBin
+
+$(BUILD_DIR)\IccProtocolLib.mak : $(IccProtocol_DIR)\$(@B).cif $(IccProtocol_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IccProtocol_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IccProtocolLib_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+IccProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IccProtocolLib.mak all\
+ "MY_INCLUDES=$(IccProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY \
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl
new file mode 100644
index 0000000..2f3f33e
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = "IccProtocolLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable IccProtocolLib support in Project"
+End
+
+PATH
+ Name = "IccProtocol_DIR"
+End
+
+MODULE
+ File = "IccProtocolLib.mak"
+ Help = "Includes IccProtocolLib.mak to Project"
+End
+
+ELINK
+ Name = "IccProtocol_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccProtocolLib.lib"
+ Parent = "IccProtocol_LIB"
+ InvokeOrder = AfterParent
+End