summaryrefslogtreecommitdiff
path: root/Chipset/NB/GOP
diff options
context:
space:
mode:
Diffstat (limited to 'Chipset/NB/GOP')
-rw-r--r--Chipset/NB/GOP/Haswell/IntelGopDriver.efibin0 -> 48032 bytes
-rw-r--r--Chipset/NB/GOP/Haswell/vbt.binbin0 -> 4608 bytes
-rw-r--r--Chipset/NB/GOP/IntelGopDriver.dxs61
-rw-r--r--Chipset/NB/GOP/IntelSaGopDriver.cif17
-rw-r--r--Chipset/NB/GOP/IntelSaGopDriver.dxs61
-rw-r--r--Chipset/NB/GOP/IntelSaGopDriver.mak69
-rw-r--r--Chipset/NB/GOP/IntelSaGopDriver.sdl59
-rw-r--r--Chipset/NB/GOP/IntelSaGopPolicy.c405
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.c871
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.cif13
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.h96
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.mak49
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sd306
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sdl72
-rw-r--r--Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.unibin0 -> 9338 bytes
15 files changed, 2079 insertions, 0 deletions
diff --git a/Chipset/NB/GOP/Haswell/IntelGopDriver.efi b/Chipset/NB/GOP/Haswell/IntelGopDriver.efi
new file mode 100644
index 0000000..04f8cc0
--- /dev/null
+++ b/Chipset/NB/GOP/Haswell/IntelGopDriver.efi
Binary files differ
diff --git a/Chipset/NB/GOP/Haswell/vbt.bin b/Chipset/NB/GOP/Haswell/vbt.bin
new file mode 100644
index 0000000..0fca66b
--- /dev/null
+++ b/Chipset/NB/GOP/Haswell/vbt.bin
Binary files differ
diff --git a/Chipset/NB/GOP/IntelGopDriver.dxs b/Chipset/NB/GOP/IntelGopDriver.dxs
new file mode 100644
index 0000000..40408e8
--- /dev/null
+++ b/Chipset/NB/GOP/IntelGopDriver.dxs
@@ -0,0 +1,61 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2015, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelGopDriver.dxs 2 1/27/15 11:17p Dennisliu $
+//
+// $Revision: 2 $
+//
+// $Date: 1/27/15 11:17p $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelGopDriver.dxs $
+//
+// 2 1/27/15 11:17p Dennisliu
+// [TAG] EIP202457
+// [Category] Improvement
+// [Description] Implement Loading Intel GOP driver Condition
+// [Files]
+// Chipset\NB\GOP\IntelGopDriver.dxs
+// Chipset\NB\GOP\IntelSaGopDriver.mak
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IntelGopDriver.dxs
+//
+// Description: Dependency expression file for Intel GOP driver.
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+#include <Protocol\IntelSaGopDriver.h>
+
+DEPENDENCY_START
+ EFI_PLATFORM_GOP_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2015, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopDriver.cif b/Chipset/NB/GOP/IntelSaGopDriver.cif
new file mode 100644
index 0000000..4b181d4
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopDriver.cif
@@ -0,0 +1,17 @@
+<component>
+ name = "Intel SA GOP Driver"
+ category = ModulePart
+ LocalRoot = "Chipset\NB\GOP\"
+ RefName = "IntelSaGopDriver"
+[files]
+"IntelSaGopDriver.sdl"
+"IntelSaGopDriver.mak"
+"IntelSaGopPolicy.c"
+"IntelSaGopDriver.dxs"
+"IntelGopDriver.dxs"
+"Haswell\IntelGopDriver.efi"
+"Haswell\vbt.bin"
+[parts]
+"IntelSaGopSetup"
+"IntelSaGopDriverProtocol"
+<endComponent>
diff --git a/Chipset/NB/GOP/IntelSaGopDriver.dxs b/Chipset/NB/GOP/IntelSaGopDriver.dxs
new file mode 100644
index 0000000..9074cbc
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopDriver.dxs
@@ -0,0 +1,61 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopDriver.dxs 1 3/08/12 10:54p Yurenlai $
+//
+// $Revision: 1 $
+//
+// $Date: 3/08/12 10:54p $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopDriver.dxs $
+//
+// 1 3/08/12 10:54p Yurenlai
+// [TAG] None
+// [Category] Improvement
+// [Description] Create Haswell Intel SA GOP Driver module part.
+// Notice : IntelGopDriver.efi and vbt.bin is dummy files.
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IntelSaGopDriver.dxs
+//
+// Description: Dependency expression file for Platform GOP Policy driver.
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+#include <Protocol\CpuIo.h>
+#include <PlatformInfo.h>
+
+DEPENDENCY_START
+ EFI_CPU_IO_PROTOCOL_GUID AND
+ EFI_PLATFORM_INFO_PROTOCOL_GUID
+DEPENDENCY_END
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopDriver.mak b/Chipset/NB/GOP/IntelSaGopDriver.mak
new file mode 100644
index 0000000..0dfa205
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopDriver.mak
@@ -0,0 +1,69 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+all : IntelSaGopDriver IgbGOPDriver
+
+IntelSaGopDriver : $(BUILD_DIR)\IntelSaGopDriver.mak IntelSaGopDriverBin
+
+IgbGOPDriver: $(BUILD_DIR)\BmpDummyName.ffs $(BUILD_DIR)\IntelGopDriver.ffs
+
+
+$(BUILD_DIR)\IntelSaGopDriver.mak : $(IntelSaGopDriver_DIR)\$(@B).cif $(IntelSaGopDriver_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IntelSaGopDriver_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelSaGopDriver_INCLUDES=\
+ $(PLATFORM_INFO_INCLUDES)\
+ $(DxeKscLib_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+
+IntelSaGopDriverBin : $(AMIDXELIB) $(DxeKscLib_LIB) $(AMICSPLib)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\IntelSaGopDriver.mak all\
+ GUID=5c266089-e103-4d43-9ab5-12d7095be2af\
+ "MY_INCLUDES=$(IntelSaGopDriver_INCLUDES)"\
+ ENTRY_POINT=IntelSaGopPolicyEntryPoint\
+ DEPEX1=$(IntelSaGopDriver_DIR)\IntelSaGopDriver.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ TYPE=BS_DRIVER\
+ COMPRESS=1
+
+$(BUILD_DIR)\BmpDummyName.ffs : $(OEM_INTEL_GOP_VBT_BIN_FILE)
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=878AC2CC-5343-46F2-B563-51F89DAF56BA \
+ TYPE=EFI_FV_FILETYPE_RAW \
+ RAWFILE=$** FFSFILE=$@ COMPRESS=0 NAME=BmpDummyName
+
+$(BUILD_DIR)\IntelGopDriver.ffs : $(OEM_INTEL_GOP_EFI_DRIVER_FILE)
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=5BBA83E6-F027-4ca7-BFD0-16358CC9E123 \
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(IntelSaGopDriver_DIR)\IntelGopDriver.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$** FFSFILE=$@ COMPRESS=0 NAME=IntelGopDriver
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopDriver.sdl b/Chipset/NB/GOP/IntelSaGopDriver.sdl
new file mode 100644
index 0000000..551c88a
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopDriver.sdl
@@ -0,0 +1,59 @@
+TOKEN
+ Name = "IntelSaGopDriver_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IntelSaGopDriver support in Project"
+End
+
+PATH
+ Name = "IntelSaGopDriver_DIR"
+End
+
+MODULE
+ Help = "Includes IntelSaGopDriver.mak to Project"
+ File = "IntelSaGopDriver.mak"
+End
+
+TOKEN
+ Name = "====== Haswell ======"
+ TokenType = Expression
+End
+
+TOKEN
+ Name = "OEM_INTEL_GOP_VBT_BIN_FILE"
+ Value = "$(IntelSaGopDriver_DIR)\Haswell\Vbt.bin"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "OEM_INTEL_GOP_EFI_DRIVER_FILE"
+ Value = "$(IntelSaGopDriver_DIR)\Haswell\IntelGopDriver.efi"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelSaGopDriver.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = BeforeParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelGopDriver.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = BeforeParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\BmpDummyName.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+
+
diff --git a/Chipset/NB/GOP/IntelSaGopPolicy.c b/Chipset/NB/GOP/IntelSaGopPolicy.c
new file mode 100644
index 0000000..ccc3b8d
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopPolicy.c
@@ -0,0 +1,405 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopPolicy.c 5 5/13/14 10:42p Dennisliu $
+//
+// $Revision: 5 $
+//
+// $Date: 5/13/14 10:42p $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopPolicy.c $
+//
+// 5 5/13/14 10:42p Dennisliu
+// [TAG] EIP167027
+// [Category] Improvement
+// [Description] [SharkBay Aptio4]Variable's attribute needs to be
+// reviewed by SA component driver
+// [Files] NBDXEBoard.c; IntelSaGopSetup.c; IntelSaGopPolicy.c;
+// NBDxe.c; NbPciCSP.c; PciHostBridge.c;
+//
+// 4 10/31/12 6:33a Jeffch
+// [TAG] None
+// [Category] Improvement
+// [Description] Add update GOP VBT address event.
+//
+// 3 8/14/12 5:42a Yurenlai
+// [TAG] None
+// [Severity] Important
+// [Description] Implemented BIOS Integration Guide Rev 1.0 to Intel SA
+// GOP driver.
+// [Files] IntelSaGopDriver.cif, IntelSaGopDriver.mak,
+// IntelSaGopDriver.sdl,
+// IntelSaGopPolicy.c, IntelSaGopSetup.c, IntelSaGopSetup.h,
+// IntelSaGopSetup.mak, IntelSaGopSetup.sd, IntelSaGopSetup.sdl,
+// IntelSaGopSetup.uni, IntelSaGopSwitch.c,
+// IntelSaGopDriver.h,
+// NBPlatformData.h
+//
+// 2 7/27/12 7:42a Yurenlai
+// [TAG] None
+// [Category] Improvement
+// [Description] Fix building error after update 4.6.5.4_Csm_OptOut_03.
+// [Files] IntelSaGopPolicy.c
+//
+// 1 3/08/12 10:54p Yurenlai
+// [TAG] None
+// [Category] Improvement
+// [Description] Create Haswell Intel SA GOP Driver module part.
+// Notice : IntelGopDriver.efi and vbt.bin is dummy files.
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IntelSaGopPolicy.c
+//
+// Description: This file initialises and Installs TerminalPlatformPolicy Protocol.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include <Token.h>
+#include <AmiDxeLib.h>
+#include <KscLib.h>
+#include <Setup.h>
+#include <AmiCspLib.h>
+#include <Protocol\IntelSaGopDriver.h>
+#include <Protocol\NBPlatformData.h>
+#if defined(CsmOptOut_SUPPORT) && (CsmOptOut_SUPPORT == 1)
+#include <AmiLoadCsmPolicy.h>
+#endif
+#define _SA_COMMON_DEFINITIONS_H_
+#include <Protocol\SaPlatformPolicy\SaPlatformPolicy.h>
+
+EFI_GUID gPlatformGOPPolicyGuid = EFI_PLATFORM_GOP_POLICY_PROTOCOL_GUID;
+EFI_GUID gDxePlatformSaPolicyGuid = DXE_PLATFORM_SA_POLICY_GUID;
+EFI_GUID gSetupGuid = SETUP_GUID;
+#if defined(CsmOptOut_SUPPORT) && (CsmOptOut_SUPPORT == 1)
+EFI_GUID gAmiOpromPolicyProtocolGuid = AMI_OPROM_POLICY_PROTOCOL_GUID;
+EFI_GUID gAmiLoadCsmGuid = AMI_LOAD_CSM_GUID;
+#endif
+
+PLATFORM_GOP_POLICY_PROTOCOL mPlatformGOPPolicy;
+DXE_PLATFORM_SA_POLICY_PROTOCOL *gDxePlatformSaPolicy;
+#if defined(CsmOptOut_SUPPORT) && (CsmOptOut_SUPPORT == 1)
+AMI_OPROM_POLICY_PROTOCOL *gAmiOpRomPolicyProtocol = NULL;
+VOID *gInterface = NULL;
+#endif
+//
+// Function implementations
+//
+
+EFI_STATUS
+GetPlatformLidStatus (
+ OUT LID_STATUS *CurrentLidStatus
+)
+{
+#if defined CRB_EC_SUPPORT && CRB_EC_SUPPORT == 1
+ EFI_STATUS Status;
+ UINT8 PortDataOut;
+ Status = InitializeKscLib ();
+
+ if (Status == EFI_SUCCESS) {
+ Status = SendKscCommand(KSC_C_READ_MEM);
+ if (Status == EFI_SUCCESS) {
+ Status = SendKscData(0x03);
+ if (Status == EFI_SUCCESS) {
+ Status = ReceiveKscData (&PortDataOut);
+ if (Status == EFI_SUCCESS) {
+ //
+ // Bit6 = Lid State (1 = Open, 0 = Closed)
+ //
+ if ((PortDataOut & BIT6) >> 6)
+ *CurrentLidStatus = LidOpen;
+ else
+ *CurrentLidStatus = LidClosed;
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ }
+#endif
+
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS
+GetVbtData (
+ OUT EFI_PHYSICAL_ADDRESS *VbtAddress,
+ OUT UINT32 *VbtSize
+)
+{
+ EFI_STATUS Status;
+ UINTN FvProtocolCount;
+ EFI_HANDLE *FvHandles;
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
+#else
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
+#endif
+ UINTN Index;
+ UINT32 AuthenticationStatus;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES FileAttributes;
+
+ UINT8 *Buffer;
+ UINTN VbtBufferSize;
+ EFI_GUID BmpImageGuid = { 0x878AC2CC, 0x5343, 0x46F2, 0xB5, 0x63, 0x51, 0xF8, 0x9D, 0xAF, 0x56, 0xBA };
+
+ Buffer = NULL;
+ FvHandles = NULL;
+ Status = pBS->LocateHandleBuffer (
+ ByProtocol,
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ NULL,
+ &FvProtocolCount,
+ &FvHandles
+ );
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; Index < FvProtocolCount; Index++) {
+ Status = pBS->HandleProtocol (
+ FvHandles[Index],
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ (VOID **) &Fv
+ );
+
+ Status = Fv->ReadFile (
+ Fv,
+ &BmpImageGuid,
+ &Buffer,
+ &VbtBufferSize,
+ &FileType,
+ &FileAttributes,
+ &AuthenticationStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ *VbtAddress = (EFI_PHYSICAL_ADDRESS)Buffer;
+ *VbtSize = (UINT32)VbtBufferSize;
+ Status = EFI_SUCCESS;
+ break;
+ }
+ }
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+
+ if (FvHandles != NULL) {
+ pBS->FreePool (FvHandles);
+ FvHandles = NULL;
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+GetPlatformDockStatus (
+ OUT DOCK_STATUS CurrentDockStatus
+)
+{
+
+ return EFI_UNSUPPORTED;
+}
+
+VOID IntelGopVbtUpdateNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS VbtAddress;
+ UINT32 VbtSize;
+
+ Status = pBS->LocateProtocol (
+ &gDxePlatformSaPolicyGuid,
+ NULL,
+ (VOID **) &gDxePlatformSaPolicy
+ );
+ if (!EFI_ERROR (Status)) {
+
+ Status = GetVbtData(&VbtAddress, &VbtSize);
+ if (!EFI_ERROR (Status)) {
+ gDxePlatformSaPolicy->IgdConfig->VbtAddress = VbtAddress;
+ gDxePlatformSaPolicy->IgdConfig->Size = VbtSize;
+ }
+ }
+ // Kill event
+ pBS->CloseEvent(Event);
+
+}
+
+EFI_STATUS
+EFIAPI
+IntelSaGopPolicyEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Entry point for the Platform GOP Policy Driver.
+
+Arguments:
+
+ ImageHandle Image handle of this driver.
+ SystemTable Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+
+--*/
+{
+ EFI_STATUS Status;
+ NB_PLATFORM_DATA NBPlatformData = {0};
+ UINTN VariableSize;
+ SETUP_DATA *SetupData = NULL;
+ EFI_EVENT DxePlatformSaPolicyEvent;
+ VOID *DxePlatformSaPolicyReg;
+ UINT32 Attributes = 0; // [ EIP167027 ]
+
+
+ InitAmiLib (ImageHandle, SystemTable);
+
+ // Read the NB Platform Data
+ VariableSize = sizeof (NB_PLATFORM_DATA);
+ //Status = pRS->GetVariable ( // [ EIP167027 ]
+ // L"NBPlatformData",
+ // &gSetupGuid,
+ // NULL,
+ // &VariableSize,
+ // &NBPlatformData
+ // );
+ Status = pRS->GetVariable (
+ L"NBPlatformData",
+ &gSetupGuid,
+ &Attributes,
+ &VariableSize,
+ &NBPlatformData
+ );
+ if (EFI_ERROR(Status))
+ Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS;
+
+ VariableSize = sizeof(SETUP_DATA);
+ Status = GetEfiVariable(
+ L"Setup",
+ &gSetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData
+ );
+
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+#if defined(CsmOptOut_SUPPORT) && (CsmOptOut_SUPPORT == 1)
+
+ Status = pBS->LocateProtocol( &gAmiLoadCsmGuid, \
+ NULL, \
+ &gInterface );
+ if(!EFI_ERROR(Status))
+ {
+ if ((SetupData->VideoOpRom == 0) || (SetupData->VideoOpRom == 2)) return EFI_UNSUPPORTED;
+ }
+
+#else
+
+#if defined(CORE_COMBINED_VERSION) && (CORE_COMBINED_VERSION <= 0x4028b)
+{
+ if ((SetupData->VideoOpRom) == 1) return EFI_UNSUPPORTED;
+}
+#else
+ return EFI_UNSUPPORTED;
+#endif // CORE_COMBINED_VERSION
+#endif // CsmOptOut_SUPPORT
+#endif // CSM_SUPPORT
+
+ pBS->SetMem (&mPlatformGOPPolicy, sizeof (PLATFORM_GOP_POLICY_PROTOCOL), 0);
+
+ mPlatformGOPPolicy.Revision = PLATFORM_GOP_POLICY_PROTOCOL_REVISION_02;
+ mPlatformGOPPolicy.GetPlatformLidStatus = GetPlatformLidStatus;
+ mPlatformGOPPolicy.GetVbtData = GetVbtData;
+ mPlatformGOPPolicy.GetPlatformDockStatus = GetPlatformDockStatus;
+
+ //
+ // Install protocol to allow access to this Policy.
+ //
+ Status = pBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gPlatformGOPPolicyGuid,
+ &mPlatformGOPPolicy,
+ NULL
+ );
+
+ //NbSetupdata Pass to SaGlobalNvsArea.
+ Status = pBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ IntelGopVbtUpdateNotify,
+ NULL,
+ &DxePlatformSaPolicyEvent
+ );
+
+ if (!EFI_ERROR (Status)) {
+ Status = pBS->RegisterProtocolNotify (
+ &gDxePlatformSaPolicyGuid,
+ DxePlatformSaPolicyEvent,
+ &DxePlatformSaPolicyReg
+ );
+ }
+
+
+ NBPlatformData.IGFXGopAvailable = 1;
+
+ // Save SETUP variables.
+ //Status = pRS->SetVariable ( // [ EIP167027 ]
+ // L"NBPlatformData",
+ // &gSetupGuid,
+ // EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ // sizeof (NB_PLATFORM_DATA),
+ // &NBPlatformData
+ // );
+ Status = pRS->SetVariable (
+ L"NBPlatformData",
+ &gSetupGuid,
+ Attributes,
+ sizeof (NB_PLATFORM_DATA),
+ &NBPlatformData
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.c b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.c
new file mode 100644
index 0000000..0253aeb
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.c
@@ -0,0 +1,871 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopSetup/IntelSaGopSetup.c 6 7/11/14 3:48a Dennisliu $
+//
+// $Revision: 6 $
+//
+// $Date: 7/11/14 3:48a $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopSetup/IntelSaGopSetup.c $
+//
+// 6 7/11/14 3:48a Dennisliu
+// [TAG] None
+// [Category] Improvement
+// [Description] Problem: #if directive for TSE_BUILD=0x1208 (EIP176870)
+// [Files]
+// Board\NB\NBSetup\NBSetup.c
+// Chipset\NB\GOP\IntelSaGopSetup\IntelSaGopSetup.c
+//
+// 5 5/13/14 10:44p Dennisliu
+// [TAG] EIP167027
+// [Category] Improvement
+// [Description] [SharkBay Aptio4]Variable's attribute needs to be
+// reviewed by SA component driver
+// [Files] NBDXEBoard.c; IntelSaGopSetup.c; IntelSaGopPolicy.c;
+// NBDxe.c; NbPciCSP.c; PciHostBridge.c;
+//
+// 4 4/23/13 8:02a Ireneyang
+// [TAG] None
+// [Severity] Improvement
+// [Description] Support for BIST (Built-In Self Test) Protocol.
+// [Files] IntelSaGopSetup.c; IntelSaGopSetup.h;
+// IntelSaGopSetup.sd;
+// IntelSaGopSetup.sd; IntelSaGopSetup.sdl;
+// IntelSaGopSetup.uni; IntelSaGopDriver.h;
+//
+// 3 4/08/13 6:31a Ireneyang
+//
+// 2 8/14/12 5:47a Yurenlai
+// [TAG] None
+// [Severity] Important
+// [Description] Implemented BIOS Integration Guide Rev 1.0 to Intel SA
+// GOP driver.
+// [Files] IntelSaGopDriver.cif, IntelSaGopDriver.mak,
+// IntelSaGopDriver.sdl, IntelSaGopPolicy.c,
+// IntelSaGopSetup.c,
+// IntelSaGopSetup.h, IntelSaGopSetup.mak,
+// IntelSaGopSetup.sd,
+// IntelSaGopSetup.sdl, IntelSaGopSetup.uni,
+// IntelSaGopSwitch.c, IntelSaGopDriver.h, NBPlatformData.h
+//
+// 1 3/08/12 10:55p Yurenlai
+// [TAG] None
+// [Category] Improvement
+// [Description] Create Haswell Intel SA GOP Driver module part.
+// Notice : IntelGopDriver.efi and vbt.bin is dummy files.
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IntelSaGopSetup.c
+//
+// Description: GOP Setup Rountines
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+
+//----------------------------------------------------------------------------
+// Include(s)
+//----------------------------------------------------------------------------
+#include <Token.h>
+#include <Setup.h>
+#include <SetupStrTokens.h>
+#include <AmiDxeLib.h>
+#include <AmiCspLib.h>
+#include <Protocol\ComponentName2.h>
+#include <Protocol\GraphicsOutput.h>
+#include <Protocol\IntelSaGopDriver.h>
+#include "IntelSaGopSetup.h"
+
+static EFI_GUID gEfiVariableGuid = EFI_GLOBAL_VARIABLE;
+static EFI_GUID gSetupGuid = SETUP_GUID;
+static EFI_GUID gGopDisplayBrightnessProtocolGuid = GOP_DISPLAY_BRIGHTNESS_PROTOCOL_GUID;
+static EFI_GUID gGopDisplayBistProtocolGuid = GOP_DISPLAY_BIST_PROTOCOL_GUID;
+
+EFI_STATUS AmiGopDeviceCheck (
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE DriverBindingHandle,
+ IN EFI_PCI_IO_PROTOCOL *PciIo
+);
+
+EFI_STATUS GetIntelSaGopSetupDriverBindingHandle (
+ IN EFI_HANDLE ControllerHandle,
+ OUT EFI_HANDLE *DriverBindingHandle
+);
+
+EFI_STATUS GetChildDeviceHandlesControledByDriver (
+ IN EFI_HANDLE DriverBindingHandle,
+ IN EFI_HANDLE ControllerHandle,
+ OUT UINTN *ChildControllerHandleCount,
+ OUT EFI_HANDLE **ChildControllerHandleBuffer
+);
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Name: GetIntelSaGopSetupDriverBindingHandle
+//
+// Description: None.
+//
+// Input: None.
+//
+// Output: None.
+//
+// Notes: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+GetIntelSaGopSetupDriverBindingHandle (
+ IN EFI_HANDLE ControllerHandle,
+ OUT EFI_HANDLE *DriverBindingHandle )
+{
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleIndex;
+ EFI_GUID **ProtocolGuidArray;
+ UINTN ArrayCount;
+ UINTN ProtocolIndex;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
+ UINTN OpenInfoCount;
+ UINTN OpenInfoIndex;
+ UINTN Index;
+
+ Status = pBS->LocateHandleBuffer(
+ AllHandles,
+ NULL,
+ NULL,
+ &HandleCount,
+ &HandleBuffer);
+ if (EFI_ERROR(Status)) return EFI_NOT_FOUND;
+
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ ProtocolGuidArray = NULL;
+ Status = pBS->ProtocolsPerHandle(
+ HandleBuffer[HandleIndex],
+ &ProtocolGuidArray,
+ &ArrayCount);
+ if (EFI_ERROR(Status)) continue;
+
+ for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
+ Status = pBS->OpenProtocolInformation(
+ HandleBuffer[HandleIndex],
+ ProtocolGuidArray[ProtocolIndex],
+ &OpenInfo,
+ &OpenInfoCount);
+ if (EFI_ERROR(Status)) continue;
+
+ for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
+ if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) {
+ if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) == EFI_OPEN_PROTOCOL_BY_DRIVER) {
+ for(Index = 0; Index < HandleCount; Index++) {
+ if(HandleBuffer[Index] == OpenInfo[OpenInfoIndex].AgentHandle) {
+ *DriverBindingHandle=HandleBuffer[Index];
+ pBS->FreePool(OpenInfo);
+ pBS->FreePool(ProtocolGuidArray);
+ pBS->FreePool(HandleBuffer);
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ }
+ }
+ if (OpenInfo != NULL) pBS->FreePool(OpenInfo);
+ }
+ if (ProtocolGuidArray != NULL) pBS->FreePool(ProtocolGuidArray);
+ }
+ if (HandleBuffer != NULL) pBS->FreePool(HandleBuffer);
+ return EFI_NOT_FOUND;
+}
+
+// <AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: GetChildDeviceHandlesControledByDriver
+//
+// Description:
+// Get all child device handles which are being opened by a specific driver.
+// The rountine will allocate pool buffer for the found child device handles,
+// and it is the caller's responsibility to safe free the buffer.
+//
+// Input:
+// IN EFI_HANDLE DriverBindingHandle - the handle of a driver which
+// contains the binding protocol
+// IN EFI_HANDLE ControllerHandle - the device controller handle be opened
+// by its child device
+// OUT UINTN ChildControllerHandleCount - the number of available
+// device handles returned in
+// ControllerHandleBuffer
+// OUT EFI_HANDLE ChildControllerHandleBuffer - a pointer to the buffer to
+// return the array of child
+// device handles
+//
+// Output:
+// EFI_STATUS
+// If returned status is not succeful or find no available device,
+// the *ChildControllerHandleBuffer will be NULL
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+// <AMI_PHDR_END>
+
+EFI_STATUS
+GetChildDeviceHandlesControledByDriver (
+ IN EFI_HANDLE DriverBindingHandle,
+ IN EFI_HANDLE ControllerHandle,
+ OUT UINTN *ChildControllerHandleCount,
+ OUT EFI_HANDLE **ChildControllerHandleBuffer )
+{
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ BOOLEAN *HandleBufferMap;
+ EFI_STATUS Status;
+ UINTN HandleIndex;
+ UINTN AvailableIndex;
+ EFI_GUID **ProtocolGuidArray;
+ UINTN ArrayCount;
+ UINTN ProtocolIndex;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
+ UINTN OpenInfoCount;
+ UINTN OpenInfoIndex;
+
+ *ChildControllerHandleCount = 0;
+ *ChildControllerHandleBuffer = NULL;
+ HandleCount = 0;
+ HandleBuffer = NULL;
+
+ if ((DriverBindingHandle == NULL) || (ControllerHandle == NULL)) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Error;
+ }
+
+ //
+ // Retrieve the list of all handles from the handle database
+ //
+ Status = pBS->LocateHandleBuffer (
+ AllHandles,
+ NULL,
+ NULL,
+ &HandleCount,
+ &HandleBuffer);
+ if (EFI_ERROR(Status)) goto Error;
+
+ //
+ // Create a map for HandleBuffer. If a handle in HandleBuffer is the wanted device handle, its map item is true.
+ //
+ HandleBufferMap = MallocZ (sizeof (BOOLEAN) * HandleCount);
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ HandleBufferMap[HandleIndex] = FALSE;
+ }
+
+ //
+ // Retrieve the list of all the protocols on each handle
+ //
+ Status = pBS->ProtocolsPerHandle (
+ ControllerHandle,
+ &ProtocolGuidArray,
+ &ArrayCount);
+ if (!EFI_ERROR (Status)) {
+ for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
+ //
+ // Retrieve the list of agents that have opened each protocol
+ //
+ Status = pBS->OpenProtocolInformation (
+ ControllerHandle,
+ ProtocolGuidArray[ProtocolIndex],
+ &OpenInfo,
+ &OpenInfoCount);
+ if (!EFI_ERROR (Status)) {
+ for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
+ if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) {
+ if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
+ //
+ // OpenInfo[OpenInfoIndex].ControllerHandle is the wanted child device handle, find it in the handlebuffer
+ // A bus driver maybe open a Controller with BY_CHILD_CONTROLLER attribute for different protocol many times,
+ //
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ if (OpenInfo[OpenInfoIndex].ControllerHandle == HandleBuffer[HandleIndex]) {
+ HandleBufferMap[HandleIndex] = TRUE;
+ }
+ }
+ }
+ }
+ }
+ pBS->FreePool (OpenInfo);
+ }
+ }
+ pBS->FreePool (ProtocolGuidArray);
+ }
+
+ //
+ // count how many device handles are found
+ //
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ if (HandleBufferMap[HandleIndex]) {
+ (*ChildControllerHandleCount)++;
+ }
+ }
+
+ if (*ChildControllerHandleCount > 0) {
+ //
+ // Copy the found device handle to returned buffer
+ //
+ *ChildControllerHandleBuffer = MallocZ (sizeof (EFI_HANDLE) * (*ChildControllerHandleCount));
+ for (HandleIndex = 0, AvailableIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ if (HandleBufferMap[HandleIndex]) {
+ (*ChildControllerHandleBuffer)[AvailableIndex] = HandleBuffer[HandleIndex];
+ AvailableIndex++;
+ }
+ }
+ }
+
+ if (HandleBuffer != NULL) pBS->FreePool (HandleBuffer);
+ return EFI_SUCCESS;
+
+Error:
+ if (HandleBuffer != NULL) pBS->FreePool (HandleBuffer);
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Name: IntelSaGopSetupInfo
+//
+// Description: This function will display Brightness Option in setup menu,
+// if the system GOP supports it.
+//
+// Input: EFI_HII_HANDLE HiiHandle
+//
+// Output: VOID
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+IntelSaGopSetupInfo(
+ EFI_HII_HANDLE HiiHandle,
+ UINT16 Class
+)
+{
+ EFI_STATUS Status;
+ UINTN SetupSize;
+ NB_GOP_PLATFORM_DATA NBGopPlatformData = {0};
+
+ UINTN ControllerHandleIndex;
+ EFI_HANDLE ControllerHandle;
+ UINTN ControllerHandleCount = 0;
+ EFI_HANDLE *ControllerHandleBuffer = NULL;
+
+ EFI_HANDLE DriverBindingHandle;
+
+ EFI_PCI_IO_PROTOCOL *PciIo;
+
+ UINTN ChildHandleCount = 0;
+ EFI_HANDLE *ChildHandleBuffer = NULL;
+ EFI_HANDLE ChildHandle;
+ UINTN ChildHandleIndex = 0;
+ UINT8 GopBistEnable;
+ UINT32 CurrentBrightness = 255;
+ GOP_DISPLAY_BRIGHTNESS_PROTOCOL *GopDisplayBrightnessProtocol = NULL;
+ GOP_DISPLAY_BIST_PROTOCOL *GopDisplayBistProtocol = NULL;
+ SETUP_DATA SetupData;
+
+ SetupSize = sizeof (SETUP_DATA);
+ Status = pRS->GetVariable (
+ L"Setup",
+ &gSetupGuid,
+ NULL,
+ &SetupSize,
+ &SetupData
+ );
+
+ GopBistEnable = (Status == EFI_SUCCESS) ? SetupData.EnableBIST : FALSE;
+
+ //
+ // Get all drivers handles which has PCI IO Protocol
+ //
+ Status = pBS->LocateHandleBuffer(
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &ControllerHandleCount,
+ &ControllerHandleBuffer);
+ if (EFI_ERROR(Status)) return;
+
+ for (ControllerHandleIndex = 0; ControllerHandleIndex < ControllerHandleCount; ControllerHandleIndex++) {
+
+ ControllerHandle = ControllerHandleBuffer[ControllerHandleIndex];
+ Status = pBS->HandleProtocol (ControllerHandle, &gEfiPciIoProtocolGuid, &PciIo);
+ if (EFI_ERROR(Status)) continue;
+
+ //
+ // Get Driver Binding Protocol for this VGA
+ //
+ Status = GetIntelSaGopSetupDriverBindingHandle (ControllerHandle, &DriverBindingHandle);
+ if (EFI_ERROR(Status)) continue;
+
+ Status = AmiGopDeviceCheck (ControllerHandle, DriverBindingHandle, PciIo);
+ if (EFI_ERROR(Status)) continue;
+
+ Status = GetChildDeviceHandlesControledByDriver (DriverBindingHandle, ControllerHandle, &ChildHandleCount, &ChildHandleBuffer);
+
+ if (!EFI_ERROR(Status)) {
+ for (ChildHandleIndex = 0; ChildHandleIndex < ChildHandleCount; ChildHandleIndex++) {
+ ChildHandle = ChildHandleBuffer[ChildHandleIndex];
+
+ //
+ // Check if this device have Graphic Output Portocol.
+ // If it does, the system would support Brightness option in setup Menu.
+ //
+ Status = pBS->OpenProtocol (
+ ChildHandle,
+ &gEfiGraphicsOutputProtocolGuid,
+ NULL,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+
+ if (!EFI_ERROR(Status)) {
+
+ Status = pBS->OpenProtocol (
+ ChildHandle,
+ &gGopDisplayBrightnessProtocolGuid,
+ (VOID**)&GopDisplayBrightnessProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+
+ if (!EFI_ERROR(Status)) {
+
+ if(GopDisplayBrightnessProtocol->Revision >= GOP_DISPLAY_BRIGHTNESS_PROTOCOL_REVISION_01) {
+
+ NBGopPlatformData.BrightnessAvailable = 1;
+ Status = GopDisplayBrightnessProtocol->GetCurrentBrightnessLevel(GopDisplayBrightnessProtocol, &CurrentBrightness);
+
+ if (EFI_ERROR(Status)) CurrentBrightness = 255;
+ }//if(GopDisplayBrightnessProtocol->Revision >= GOP_DISPLAY_BRIGHTNESS_PROTOCOL_REVISION_01)
+ }
+
+ Status = pBS->OpenProtocol (
+ ChildHandle,
+ &gGopDisplayBistProtocolGuid,
+ (VOID**)&GopDisplayBistProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+
+ if (!EFI_ERROR(Status)) {
+
+ if(GopDisplayBistProtocol->Revision >= GOP_DISPLAY_BIST_PROTOCOL_REVISION_01) {
+
+ NBGopPlatformData.GopBistAvailable = 1;
+
+ if (GopBistEnable == 1)
+ Status = GopDisplayBistProtocol->EnableBist(GopDisplayBistProtocol);
+ else
+ Status = GopDisplayBistProtocol->DisableBist(GopDisplayBistProtocol);
+ }//if(GopDisplayBistProtocol->Revision >= GOP_DISPLAY_BIST_PROTOCOL_REVISION_01)
+ }
+
+ }
+
+ //Status = pRS->SetVariable ( // [ EIP167027 ]
+ // L"NBGopPlatformData",
+ // &gSetupGuid,
+ // EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ // sizeof (NB_GOP_PLATFORM_DATA),
+ // &NBGopPlatformData
+ // );
+ Status = pRS->SetVariable (
+ L"NBGopPlatformData",
+ &gSetupGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (NB_GOP_PLATFORM_DATA),
+ &NBGopPlatformData
+ );
+
+ }//for (ChildHandleIndex = 0; ChildHandleIndex < ChildHandleCount; ChildHandleIndex++)
+ }//if (!EFI_ERROR(Status))
+ }//for (ControllerHandleIndex = 0; ControllerHandleIndex < ControllerHandleCount; ControllerHandleIndex++)
+ return;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Name: IntelGopSwitchFunction
+//
+// Description: For overriding ELink, AmiDefaultGopSwitchFunction.
+// If it's Intel Device, the system should do this function, IntelGopSwitchFunction.
+//
+// Input: None.
+//
+// Output: None.
+//
+// Notes: None.
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+IntelGopSwitchFunction (
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE DriverBindingHandle,
+ IN SETUP_DATA *SetupData,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINTN ChildHandleCount = 0;
+ EFI_HANDLE *ChildHandleBuffer = NULL;
+ UINTN ChildHandleIndex = 0;
+ EFI_HANDLE OutPutDevHandle;
+
+ EFI_DEVICE_PATH_PROTOCOL *GopDevicePath = NULL;
+ EFI_DEVICE_PATH_PROTOCOL *GopAcpiAdrDPNode = NULL;
+ ACPI_ADR_DEVICE_PATH *AcpiDPNode;
+
+ UINTN SetupSize;
+ NB_GOP_PLATFORM_DATA NBGopPlatformData = {0};
+ GOP_DISPLAY_BRIGHTNESS_PROTOCOL *GopDisplayBrightnessProtocol = NULL;
+ GOP_DISPLAY_BIST_PROTOCOL *GopDisplayBistProtocol = NULL;
+ UINT32 MaxBrightness = 255;
+ UINT32 CurrentBrightness = 255;
+
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_DEV_INFO *Dev;
+
+ Status = pBS->HandleProtocol (ControllerHandle, &gEfiPciIoProtocolGuid, &PciIo);
+ if (EFI_ERROR(Status)) return Status;
+
+ Dev = (PCI_DEV_INFO*)PciIo;
+
+ //
+ // If it's not Intel VGA, don't do this part.
+ //
+ if (Dev->DevVenId.VenId != 0x8086) {
+ return EFI_UNSUPPORTED;
+ }
+
+ SetupSize = sizeof (NB_GOP_PLATFORM_DATA);
+
+ AcpiDPNode = (ACPI_ADR_DEVICE_PATH*)GopAcpiAdrDPNode = DPGetLastNode(DevicePath);
+ Status = pBS->ConnectController( ControllerHandle, NULL, GopAcpiAdrDPNode, TRUE );
+
+// Status = GetChildDeviceHandlesControledByDriver (DriverBindingHandle, ControllerHandle, &ChildHandleCount, &ChildHandleBuffer);
+
+ if (!EFI_ERROR(Status)) {
+ //
+ // Find out Current Installed GOP Device
+ //
+// for (ChildHandleIndex = 0; ChildHandleIndex < ChildHandleCount; ChildHandleIndex++) {
+// if (SetupData->GopOutputSelect == ChildHandleIndex) {
+//
+// Status = pBS->OpenProtocol (
+// ChildHandleBuffer[ChildHandleIndex],
+// &gEfiDevicePathProtocolGuid,
+// (VOID**)&GopDevicePath,
+// NULL,
+// NULL,
+// EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+// if (EFI_ERROR(Status)) break;
+//
+// //
+// // If Current installed GOP is Intels', conncect it.
+// //
+// if (!EFI_ERROR(Status)) {
+// AcpiDPNode = (ACPI_ADR_DEVICE_PATH*)GopAcpiAdrDPNode = DPGetLastNode(GopDevicePath);
+// Status = pBS->ConnectController( ControllerHandle, NULL, GopAcpiAdrDPNode, TRUE );
+// }
+//
+// //
+// // Check if this device have Graphic Output Portocol.
+// // If it does, the system would support Brightness option in setup Menu.
+// //
+// Status = pBS->OpenProtocol (
+// ChildHandleBuffer[ChildHandleIndex],
+// &gEfiGraphicsOutputProtocolGuid,
+// NULL,
+// NULL,
+// NULL,
+// EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+ Status = pBS->LocateDevicePath(&gGopDisplayBrightnessProtocolGuid, &DevicePath, &OutPutDevHandle);
+
+ if (!EFI_ERROR(Status)) {
+
+ Status = pBS->OpenProtocol (
+ OutPutDevHandle,
+ &gGopDisplayBrightnessProtocolGuid,
+ (VOID**)&GopDisplayBrightnessProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+ if (!EFI_ERROR(Status)) {
+ if(GopDisplayBrightnessProtocol->Revision >= GOP_DISPLAY_BRIGHTNESS_PROTOCOL_REVISION_01) {
+ NBGopPlatformData.BrightnessAvailable = 1;
+ Status = GopDisplayBrightnessProtocol->GetMaxBrightnessLevel(GopDisplayBrightnessProtocol, &MaxBrightness);
+ if (!EFI_ERROR(Status)) {
+ if (SetupData->GopBrightness > MaxBrightness) {
+ SetupData->GopBrightness = MaxBrightness;
+#if defined(EFI_SPECIFICATION_VERSION) && EFI_SPECIFICATION_VERSION > 0x20000
+ Status = HiiLibSetBrowserData (SetupSize, SetupData, &gSetupGuid, L"Setup");
+#endif
+ }
+ Status = GopDisplayBrightnessProtocol->GetCurrentBrightnessLevel(GopDisplayBrightnessProtocol, &CurrentBrightness);
+ if (!EFI_ERROR(Status)) {
+ if(CurrentBrightness != SetupData->GopBrightness)
+ Status = GopDisplayBrightnessProtocol->SetBrightnessLevel(GopDisplayBrightnessProtocol, SetupData->GopBrightness);
+ }
+ }
+ } // GOP_DISPLAY_BRIGHTNESS_PROTOCOL_REVISION_01
+ } //OpenProtocol gGopDisplayBrightnessProtocol
+
+ Status = pBS->OpenProtocol (
+ OutPutDevHandle,
+ &gGopDisplayBistProtocolGuid,
+ (VOID**)&GopDisplayBistProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+
+ if (!EFI_ERROR(Status)) {
+
+ if(GopDisplayBistProtocol->Revision >= GOP_DISPLAY_BIST_PROTOCOL_REVISION_01) {
+
+ NBGopPlatformData.GopBistAvailable = 1;
+
+ if (SetupData->EnableBIST == 1)
+ Status = GopDisplayBistProtocol->EnableBist(GopDisplayBistProtocol);
+ else
+ Status = GopDisplayBistProtocol->DisableBist(GopDisplayBistProtocol);
+ }//if(GopDisplayBistProtocol->Revision >= GOP_DISPLAY_BIST_PROTOCOL_REVISION_01)
+ } //OpenProtocol gGopDisplayBistProtocolGuid
+
+ }
+// }// if (SetupData->GopOutputSelect == ChildHandleIndex)
+// }// for (ChildHandleIndex = 0; ChildHandleIndex < ChildHandleCount; ChildHandleIndex++)
+ }
+
+ Status = HiiLibSetBrowserData (
+ sizeof (NB_GOP_PLATFORM_DATA),
+ &NBGopPlatformData,
+ &gSetupGuid,
+ L"NBGopPlatformData"
+ );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Name: IntelGopMultifunctionCallback
+//
+// Description: If the device support Multifunction, it supports its key
+// callbak funtion.
+//
+// Input: None.
+//
+// Output: None.
+//
+// Notes: None.
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS IntelGopMultifunctionCallback (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key )
+{
+
+ EFI_STATUS Status = EFI_SUCCESS;
+ SETUP_DATA *SetupData = NULL;
+ CALLBACK_PARAMETERS *CallbackParameters = NULL;
+ UINTN SetupSize;
+ EFI_STATUS NBGopPlatformDataStatus = EFI_UNSUPPORTED;
+ NB_GOP_PLATFORM_DATA NBGopPlatformData = {0};
+ UINTN ControllerHandleIndex;
+ EFI_HANDLE ControllerHandle;
+ UINTN ControllerHandleCount = 0;
+ EFI_HANDLE *ControllerHandleBuffer = NULL;
+
+ EFI_HANDLE DriverBindingHandle;
+
+ EFI_PCI_IO_PROTOCOL *PciIo;
+
+ UINTN ChildHandleCount = 0;
+ EFI_HANDLE *ChildHandleBuffer = NULL;
+ EFI_HANDLE ChildHandle;
+ UINTN ChildHandleIndex = 0;
+
+ UINT32 CurrentBrightness = 255;
+ GOP_DISPLAY_BRIGHTNESS_PROTOCOL *GopDisplayBrightnessProtocol = NULL;
+ GOP_DISPLAY_BIST_PROTOCOL *GopDisplayBistProtocol = NULL;
+
+ UINT32 MaxBrightness = 255;
+
+ SetupSize = sizeof (SETUP_DATA);
+
+ CallbackParameters = GetCallbackParameters();
+
+#if ((TSE_BUILD >= 0x1224) && (EFI_SPECIFICATION_VERSION >= 0x2000A))
+ if (CallbackParameters->Action != EFI_BROWSER_ACTION_CHANGED) return Status;
+#elif ((TSE_BUILD > 0x1208) && (EFI_SPECIFICATION_VERSION >= 0x2000A))
+ if (CallbackParameters->Action != EFI_BROWSER_ACTION_CHANGING) return Status;
+#endif
+
+ Status = pBS->AllocatePool (EfiBootServicesData, SetupSize, &SetupData);
+ if(EFI_ERROR(Status)) return Status;
+
+#if defined(EFI_SPECIFICATION_VERSION) && EFI_SPECIFICATION_VERSION > 0x20000
+ Status = HiiLibGetBrowserData (&SetupSize, SetupData, &gSetupGuid, L"Setup");
+ if(EFI_ERROR(Status)) return Status;
+#else
+ SetupData = (SETUP_DATA*)CallbackParameters->Data->NvRamMap;
+#endif
+
+#if defined(EFI_SPECIFICATION_VERSION) && EFI_SPECIFICATION_VERSION > 0x20000
+ SetupSize = sizeof (NB_GOP_PLATFORM_DATA);
+ NBGopPlatformDataStatus = HiiLibGetBrowserData (&SetupSize, &NBGopPlatformData, &gSetupGuid, L"NBGopPlatformData");
+#endif
+ //
+ // Get all drivers handles which has PCI IO Protocol
+ //
+ Status = pBS->LocateHandleBuffer(
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &ControllerHandleCount,
+ &ControllerHandleBuffer);
+ if (EFI_ERROR(Status)) return Status;
+
+ for (ControllerHandleIndex = 0; ControllerHandleIndex < ControllerHandleCount; ControllerHandleIndex++) {
+
+ ControllerHandle = ControllerHandleBuffer[ControllerHandleIndex];
+ Status = pBS->HandleProtocol (ControllerHandle, &gEfiPciIoProtocolGuid, &PciIo);
+ if (EFI_ERROR(Status)) continue;
+
+ Status = GetIntelSaGopSetupDriverBindingHandle (ControllerHandle, &DriverBindingHandle);
+ if (EFI_ERROR(Status)) continue;
+
+ Status = AmiGopDeviceCheck (ControllerHandle, DriverBindingHandle, PciIo);
+ if (EFI_ERROR(Status)) continue;
+
+ Status = GetChildDeviceHandlesControledByDriver (DriverBindingHandle, ControllerHandle, &ChildHandleCount, &ChildHandleBuffer);
+
+ if (!EFI_ERROR(Status)) {
+ for (ChildHandleIndex = 0; ChildHandleIndex < ChildHandleCount; ChildHandleIndex++) {
+ ChildHandle = ChildHandleBuffer[ChildHandleIndex];
+
+ //
+ // Check if this device have Graphic Output Portocol.
+ // If it does, the system would support Brightness option in setup Menu.
+ //
+ Status = pBS->OpenProtocol (
+ ChildHandle,
+ &gEfiGraphicsOutputProtocolGuid,
+ NULL,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+
+ if (!EFI_ERROR(Status)) {
+
+ if (Key == AGP_BRIGHTNESS_KEY) {
+ Status = pBS->OpenProtocol (
+ ChildHandle,
+ &gGopDisplayBrightnessProtocolGuid,
+ (VOID**)&GopDisplayBrightnessProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+ if (!EFI_ERROR(Status)) {
+ if(GopDisplayBrightnessProtocol->Revision >= GOP_DISPLAY_BRIGHTNESS_PROTOCOL_REVISION_01) {
+ NBGopPlatformData.BrightnessAvailable = 1;
+ Status = GopDisplayBrightnessProtocol->GetMaxBrightnessLevel(GopDisplayBrightnessProtocol, &MaxBrightness);
+ if (!EFI_ERROR(Status)) {
+ if (SetupData->GopBrightness > MaxBrightness) {
+ SetupData->GopBrightness = MaxBrightness;
+#if defined(EFI_SPECIFICATION_VERSION) && EFI_SPECIFICATION_VERSION > 0x20000
+ SetupSize = sizeof (SETUP_DATA);
+ Status = HiiLibSetBrowserData (SetupSize, SetupData, &gSetupGuid, L"Setup");
+#endif
+ }
+ Status = GopDisplayBrightnessProtocol->GetCurrentBrightnessLevel(GopDisplayBrightnessProtocol, &CurrentBrightness);
+ if (!EFI_ERROR(Status)) {
+ if(CurrentBrightness != SetupData->GopBrightness)
+ Status = GopDisplayBrightnessProtocol->SetBrightnessLevel(GopDisplayBrightnessProtocol, SetupData->GopBrightness);
+ }
+ }
+ } // GOP_DISPLAY_BRIGHTNESS_PROTOCOL_REVISION_01
+ } //OpenProtocol GopDisplayBrightnessProtocol
+ } // AGP_BRIGHTNESS_KEY
+
+ if (Key == AGP_BIST_KEY) {
+ Status = pBS->OpenProtocol (
+ ChildHandle,
+ &gGopDisplayBistProtocolGuid,
+ (VOID**)&GopDisplayBistProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
+
+ if (!EFI_ERROR(Status)) {
+
+ if(GopDisplayBistProtocol->Revision >= GOP_DISPLAY_BIST_PROTOCOL_REVISION_01) {
+
+ NBGopPlatformData.GopBistAvailable = 1;
+
+ if (SetupData->EnableBIST == 1)
+ Status = GopDisplayBistProtocol->EnableBist(GopDisplayBistProtocol);
+ else
+ Status = GopDisplayBistProtocol->DisableBist(GopDisplayBistProtocol);
+ }//if(GopDisplayBistProtocol->Revision >= GOP_DISPLAY_BIST_PROTOCOL_REVISION_01)
+ } //OpenProtocol gGopDisplayBistProtocolGuid
+ } // AGP_BIST_KEY
+ }//OpenProtocol gEfiGraphicsOutputProtocolGuid
+
+ }//for (ChildHandleIndex = 0; ChildHandleIndex < ChildHandleCount; ChildHandleIndex++)
+ }//if (!EFI_ERROR(Status))
+ }//for (ControllerHandleIndex = 0; ControllerHandleIndex < ControllerHandleCount; ControllerHandleIndex++)
+
+#if defined(EFI_SPECIFICATION_VERSION) && EFI_SPECIFICATION_VERSION > 0x20000
+ if(!EFI_ERROR(NBGopPlatformDataStatus)) {
+ HiiLibSetBrowserData (
+ sizeof (NB_GOP_PLATFORM_DATA),
+ &NBGopPlatformData,
+ &gSetupGuid,
+ L"NBGopPlatformData"
+ );
+ }
+#endif
+ return Status;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.cif b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.cif
new file mode 100644
index 0000000..429afd0
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "IntelSaGopSetup"
+ category = ModulePart
+ LocalRoot = "Chipset\NB\GOP\IntelSaGopSetup"
+ RefName = "IntelSaGopSetup"
+[files]
+"IntelSaGopSetup.sdl"
+"IntelSaGopSetup.mak"
+"IntelSaGopSetup.sd"
+"IntelSaGopSetup.uni"
+"IntelSaGopSetup.c"
+"IntelSaGopSetup.h"
+<endComponent>
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.h b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.h
new file mode 100644
index 0000000..c46eef8
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.h
@@ -0,0 +1,96 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopSetup/IntelSaGopSetup.h 3 4/23/13 8:01a Ireneyang $
+//
+// $Revision: 3 $
+//
+// $Date: 4/23/13 8:01a $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopSetup/IntelSaGopSetup.h $
+//
+// 3 4/23/13 8:01a Ireneyang
+// [TAG] None
+// [Severity] Improvement
+// [Description] Support for BIST (Built-In Self Test) Protocol.
+// [Files] IntelSaGopSetup.c; IntelSaGopSetup.h;
+// IntelSaGopSetup.sd;
+// IntelSaGopSetup.sd; IntelSaGopSetup.sdl;
+// IntelSaGopSetup.uni; IntelSaGopDriver.h;
+//
+// 2 8/14/12 5:47a Yurenlai
+// [TAG] None
+// [Severity] Important
+// [Description] Implemented BIOS Integration Guide Rev 1.0 to Intel SA
+// GOP driver.
+// [Files] IntelSaGopDriver.cif, IntelSaGopDriver.mak,
+// IntelSaGopDriver.sdl, IntelSaGopPolicy.c,
+// IntelSaGopSetup.c,
+// IntelSaGopSetup.h, IntelSaGopSetup.mak,
+// IntelSaGopSetup.sd,
+// IntelSaGopSetup.sdl, IntelSaGopSetup.uni,
+// IntelSaGopSwitch.c, IntelSaGopDriver.h, NBPlatformData.h
+//
+// 1 3/08/12 10:55p Yurenlai
+// [TAG] None
+// [Category] Improvement
+// [Description] Create Haswell Intel SA GOP Driver module part.
+// Notice : IntelGopDriver.efi and vbt.bin is dummy files.
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IntelSaGopSetup.h
+//
+// Description: GOP Specific Setup Variables and Structures
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+#ifndef _NB_GOP_PLATFORM_DATA_H_
+#define _NB_GOP_PLATFORM_DATA_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ #pragma pack(1)
+
+ typedef struct _NB_GOP_PLATFORM_DATA
+ {
+ UINT8 BrightnessAvailable;
+ UINT8 GopBistAvailable;
+ }NB_GOP_PLATFORM_DATA;
+
+ #pragma pack()
+
+/****** DO NOT WRITE BELOW THIS LINE *******/
+#ifdef __cplusplus
+}
+#endif
+#endif
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.mak b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.mak
new file mode 100644
index 0000000..49cf3fe
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.mak
@@ -0,0 +1,49 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: IntelSaGopSetup.mak
+#
+# Description: This make file builds north bridge Setup
+# components and link them to respective binary
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+All : IntelSaGopSetup
+
+IntelSaGopSetup : $(BUILD_DIR)\IntelSaGopSetup.mak
+
+$(BUILD_DIR)\IntelSaGopSetup.mak : $(IntelSaGopSetup_DIR)\$(@B).cif $(IntelSaGopSetup_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IntelSaGopSetup_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SetupBin : $(BUILD_DIR)\IntelSaGopSetup.obj
+
+$(BUILD_DIR)\IntelSaGopSetup.obj : $(IntelSaGopSetup_DIR)\IntelSaGopSetup.c $(BUILD_DIR)\SetupStrTokens.h
+ $(CC) $(CFLAGS) /Fo$(BUILD_DIR)\ $(IntelSaGopSetup_DIR)\IntelSaGopSetup.c
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sd b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sd
new file mode 100644
index 0000000..b62c2af
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sd
@@ -0,0 +1,306 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopSetup/IntelSaGopSetup.sd 7 8/06/14 10:28p Dennisliu $
+//
+// $Revision: 7 $
+//
+// $Date: 8/06/14 10:28p $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/IntelGopDriver/IntelSaGopSetup/IntelSaGopSetup.sd $
+//
+// 7 8/06/14 10:28p Dennisliu
+// [TAG] EIP180652
+// [Category] Improvement
+// [Description] IntelSaGopSetup needs updated to support latest
+// AmiGopPolicy.
+// [Files] Chipset\NB\GOP\IntelSaGopSetup\IntelSaGopSetup.sd
+//
+// 6 4/11/14 5:26a Dennisliu
+// [TAG] None
+// [Severity] Improvement
+// [Description] Fixed coding error.
+// [Files] IntelSaGopSetup.sd;
+//
+// 4 1/20/14 9:30p Ireneyang
+// [TAG] None
+// [Severity] Improvement
+// [Description] Fix showing messages,
+// "invalid token near line xxx (text was '\')",
+// when building code.
+// [Files] IntelSaGopSetup.sd;
+//
+// 3 4/23/13 8:03a Ireneyang
+// [TAG] None
+// [Severity] Improvement
+// [Description] Support for BIST (Built-In Self Test) Protocol.
+// [Files] IntelSaGopSetup.c; IntelSaGopSetup.h;
+// IntelSaGopSetup.sd;
+// IntelSaGopSetup.sd; IntelSaGopSetup.sdl;
+// IntelSaGopSetup.uni; IntelSaGopDriver.h;
+//
+// 2 8/14/12 5:47a Yurenlai
+// [TAG] None
+// [Severity] Important
+// [Description] Implemented BIOS Integration Guide Rev 1.0 to Intel SA
+// GOP driver.
+// [Files] IntelSaGopDriver.cif, IntelSaGopDriver.mak,
+// IntelSaGopDriver.sdl, IntelSaGopPolicy.c,
+// IntelSaGopSetup.c,
+// IntelSaGopSetup.h, IntelSaGopSetup.mak,
+// IntelSaGopSetup.sd,
+// IntelSaGopSetup.sdl, IntelSaGopSetup.uni,
+// IntelSaGopSwitch.c, IntelSaGopDriver.h, NBPlatformData.h
+//
+// 1 3/08/12 10:55p Yurenlai
+// [TAG] None
+// [Category] Improvement
+// [Description] Create Haswell Intel SA GOP Driver module part.
+// Notice : IntelGopDriver.efi and vbt.bin is dummy files.
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IntelSaGopSetup.sd
+//
+// Description: GOP setup form
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+
+#ifdef SETUP_DATA_DEFINITION
+//----------------------------------------------------------------------------
+// Put NVRAM data definitions here.
+// For example: UINT8 Data1;
+// These definitions will be converted by the build process
+// to a definitions of SETUP_DATA fields.
+//----------------------------------------------------------------------------
+ UINT8 GopOutputSelect;
+ UINT32 GopBrightness;
+ UINT8 EnableBIST;
+#endif //SETUP_DATA_DEFINITION
+
+#ifdef FORM_SET_TYPEDEF
+ #include "IntelSaGopSetup.h"
+ #include "Board\EM\AmiGopPolicy\AmiGopPolicy.h"
+#endif
+
+//Select Top level menu itmem (forset) for you pages
+#ifdef ADVANCED_FORM_SET
+ #ifndef SUPPRESS_GRAYOUT_ENDIF //old Core
+ #define SUPPRESS_GRAYOUT_ENDIF endif;
+ #endif
+
+ #ifdef FORM_SET_VARSTORE
+ varstore AMI_GOP_POLICY_SETUP_DATA,
+ key = AUTO_ID(AMI_GOP_POLICY_SETUP_DATA_ID),
+ name = AmiGopPolicySetupData,
+ guid = AMI_GOP_POLICY_VARIABLE_GUID;
+
+ varstore NB_GOP_PLATFORM_DATA,
+ key = AUTO_ID(NB_GOP_PLATFORM_DATA_ID),
+ name = NBGopPlatformData,
+ guid = SETUP_GUID;
+ #endif
+
+#ifdef FORM_SET_GOTO
+// Define goto commands for the forms defined in this file
+// goto ID_OF_MY_FORM,
+// prompt = STRING_TOKEN(STR_FORM_TITLE),
+// help = STRING_TOKEN(STR_FORM_HELP);
+ suppressif ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x0;
+ goto AGP_FORM_ID,
+ prompt = STRING_TOKEN(STR_TITLE),
+ help = STRING_TOKEN(STR_TITLE_HELP);
+ endif; //suppressif GopDeviceCount < 1
+#endif //FORM_SET_GOTO
+
+#ifdef FORM_SET_FORM
+// Define forms
+// form formid = AUTO_ID(ID_OF_MY_FORM),
+// title = STRING_TOKEN(STR_FORM_TITLE);
+// endform;
+ form formid = AUTO_ID(AGP_FORM_ID),
+ title = STRING_TOKEN(STR_TITLE);
+
+ //suppressif ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x0;
+ SUBTITLE(STRING_TOKEN(STR_GOP_DEVICE_NAME_0))
+ SUBTITLE(STRING_TOKEN(STR_GOP_DRIVER_NAME_0))
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x1;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_0);
+ endoneof;
+ endif; //suppressif GopOutputCount != 1
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x2;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_1);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 2
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x3;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_2);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_2), value = 2, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 3
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x4;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_3);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_3), value = 3, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 4
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x5;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_4);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_3), value = 3, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_4), value = 4, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 5
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x6;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_5);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_3), value = 3, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_4), value = 4, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_5), value = 5, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 6
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x7;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_6);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_3), value = 3, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_4), value = 4, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_5), value = 5, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_6), value = 6, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 7
+
+ suppressif NOT ideqval AMI_GOP_POLICY_SETUP_DATA.GopOutputCount == 0x8;
+ oneof varid = SETUP_DATA.GopOutputSelect,
+ prompt = STRING_TOKEN(STR_GOP_OUTPUT_SELECT),
+ help = STRING_TOKEN(STR_GOP_OUTPUT_HELP),
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_0), value = 0, flags = DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_KEY_7);
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_3), value = 3, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_4), value = 4, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_5), value = 5, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_6), value = 6, flags = 0;
+ option text = STRING_TOKEN(STR_GOP_OUTPUT_NAME_7), value = 7, flags = 0;
+ endoneof;
+ endif; //suppressif GopOutputCount != 8
+
+
+ suppressif ideqval NB_GOP_PLATFORM_DATA.BrightnessAvailable == 0x00;
+ numeric varid = SETUP_DATA.GopBrightness,
+ prompt = STRING_TOKEN(STR_GOP_BRIGHTNESS),
+ help = STRING_TOKEN(STR_GOP_BRIGHTNESS_HELP),
+ flags = INTERACTIVE, key = AUTO_ID(AGP_BRIGHTNESS_KEY),
+ minimum = 0,
+ maximum = 0xffffffff,
+ step = 1,
+ default = 255,
+ option text = STRING_TOKEN (STR_GOP_BRIGHTNESS), value = 0, flags = MANUFACTURING | INTERACTIVE;
+ endnumeric;
+ endif;
+
+ suppressif ideqval NB_GOP_PLATFORM_DATA.GopBistAvailable == 0x00;
+ oneof varid = SETUP_DATA.EnableBIST,
+ prompt = STRING_TOKEN(STR_GOP_BIST_ENABLE),
+ help = STRING_TOKEN(STR_GOP_BIST_ENABLE_HELP),
+ option text = STRING_TOKEN(STR_COMMON_DISABLED), value = 0, flags = RESET_REQUIRED | DEFAULT | MANUFACTURING | INTERACTIVE, key = AUTO_ID(AGP_BIST_KEY);
+ option text = STRING_TOKEN(STR_COMMON_ENABLED), value = 1, flags = RESET_REQUIRED;
+ endoneof;
+ endif; //suppressif GopBistAvailable == 0
+
+ //endif; //suppressif GopDeviceCount < 1
+/*
+ SEPARATOR
+
+ suppressif ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x0 OR
+ ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x1;
+ SUBTITLE(STRING_TOKEN(STR_GOP_DEVICE_NAME_1))
+ SUBTITLE(STRING_TOKEN(STR_GOP_DRIVER_NAME_1))
+ endif; //suppressif GopDeviceCount < 2
+
+ SEPARATOR
+
+ suppressif ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x0 OR
+ ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x1 OR
+ ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x2;
+ SUBTITLE(STRING_TOKEN(STR_GOP_DEVICE_NAME_2))
+ SUBTITLE(STRING_TOKEN(STR_GOP_DRIVER_NAME_2))
+ endif; //suppressif GopDeviceCount < 3
+
+ SEPARATOR
+
+ suppressif ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x0 OR
+ ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x1 OR
+ ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x2 OR
+ ideqval AMI_GOP_POLICY_SETUP_DATA.GopDeviceCount == 0x3;
+ SUBTITLE(STRING_TOKEN(STR_GOP_DEVICE_NAME_3))
+ SUBTITLE(STRING_TOKEN(STR_GOP_DRIVER_NAME_3))
+ endif; //suppressif GopDeviceCount < 4
+*/
+ endform;
+
+#endif //FORM_SET_FORM
+
+#endif //ADVANCED_FORM_SET
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sdl b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sdl
new file mode 100644
index 0000000..ebfe462
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.sdl
@@ -0,0 +1,72 @@
+TOKEN
+ Name = "IntelSaGopSetup_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable IntelSaGopSetup support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "AmiGopPolicy" "=" "1"
+End
+
+PATH
+ Name = "IntelSaGopSetup_DIR"
+End
+
+MODULE
+ Help = "Includes IntelSaGopSetup.mak to Project"
+ File = "IntelSaGopSetup.mak"
+End
+
+ELINK
+ Name = "IntelSaGopSetupInfo,"
+ Parent = "InitAmiGopPolicyStrings,"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(IntelSaGopSetup_DIR)"
+ Parent = "$(GLOBAL_DEFINES)"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "====== For Intel Brightness ======"
+ TokenType = Expression
+End
+
+ELINK
+ Name = "$(IntelSaGopSetup_DIR)\IntelSaGopSetup.sd"
+ Parent = "$(AMIGOPPOLICY_DIR)\AmiGopPolicy.sd"
+ InvokeOrder = ReplaceParent
+ Token = "AmiGopPolicy" "=" "1"
+End
+
+ELINK
+ Name = "$(IntelSaGopSetup_DIR)\IntelSaGopSetup.uni"
+ Parent = "$(AMIGOPPOLICY_DIR)\AmiGopPolicy.uni"
+ InvokeOrder = ReplaceParent
+ Token = "AmiGopPolicy" "=" "1"
+End
+
+ELINK
+ Name = "IntelGopSwitchFunction,"
+ Parent = "AmiDefaultGopSwitchFunction,"
+ InvokeOrder = ReplaceParent
+ Token = "AmiGopPolicy" "=" "1"
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,AGP_BRIGHTNESS_KEY,IntelGopMultifunctionCallback),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+ Token = "AmiGopPolicy" "=" "1"
+End
+
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,AGP_BIST_KEY,IntelGopMultifunctionCallback),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+ Token = "AmiGopPolicy" "=" "1"
+End
diff --git a/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.uni b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.uni
new file mode 100644
index 0000000..55eef78
--- /dev/null
+++ b/Chipset/NB/GOP/IntelSaGopSetup/IntelSaGopSetup.uni
Binary files differ